Package: bany
BANYA collection of scripts to...Convert text in a PDF into YNAB transactionsSplit a series of transactions between peopleSolve the constrained partitioning problem for investingSetuppyenvlocal3.11.1
pipxinstallbany--python$(whichpython)bany--helpCommandsbany extractCreate YNAB transactions from a PDFExamplesRun the extract command to parse a PDF and upload transactions to YNABbanyextractpdf--inp/path/to/pdf--configconfig.yaml
banyextractpdf--inp/path/to/pdf--configconfig.yaml--uploadconfig.yamlDefine rules to match patterns in the text of a PDFDefine the transactions to create from these matches# Regular Expressions defined for date like valuesdates:Force Date:value:|-2023-01-01Check Date:regex:|-Check\s+Date\s+(?P<DATE>{MONTHS}\s+\d+,?\s+\d\d\d\d)# Regular Expressions defined for money like valuesamounts:401K:group:EARNINGSinflow:trueregex:|-401K\s+(?P<HOURS>{NUMBER})\s+(?P<MONEY>{AMOUNT})\s+(?P<TOTAL>{AMOUNT})Salary:group:EARNINGSinflow:trueregex:|-REGULAR\s+(?P<RATES>{NUMBER})\s+(?P<HOURS>{NUMBER})\s+(?P<MONEY>{AMOUNT})\s+(?P<TOTAL>{AMOUNT})TOTAL-EARNINGS:group:EARNINGSinflow:truetotal:trueregex:|-Gross\s+Earnings\s+(?P<HOURS>{NUMBER})\s+(?P<MONEY>{AMOUNT})\s+(?P<TOTAL>{AMOUNT})# Transactions to push to a YNAB budget (these may reference the matches defined above)transactions:-budget:2023account:'Checking'category:'InternalMasterCategory:Inflow:ReadytoAssign'payee:Companycolor:redamount:Salarydate:Check Date-budget:2023account:'Company'category:'Investment:Fidelity'payee:'Transfer:Fidelity:Syapse'memo:2023color:yellowamount:401Kdate:Check Datebany splitThis is a script to help split transactions between multiple people.ExamplesThis script opens an interactive loop.banysplitRun a series of commandsYou can run a series of commands defined in a text file.split -a 12.79 -p Costco -C Food -d Dad=1 Adam=0   Doug=0   -c Adam=1
split -a  7.49 -p Costco -C Food -d Dad=1 Adam=0   Doug=0   -c Adam=1
summarizebany>@costco.txtShow the possible commandsbany>helpDocumentedcommands(use'help -v'forverbose/'help <topic>'fordetails):

MyCategory===========cleardeleteshowsplitsummarizetaxtipUncategorized=============helphistoryquitsetshortcutsSplit some transactions between some peoplebany>split--amount10.00--payeeGroceryStore--categoryFood--debitAlice=2/5Bob=3/5--creditBob=1groupamountratepayeecategorydebtorscreditorsAliceBobAlice.wBob.wAlice.$Bob.$WhoDelta00$10.000GroceryStoreFood(Alice,Bob)(Bob)4006000.40.6$4.00$6.00-$0.00

bany>split--amount15.75--payeeRestaurant--categoryDinner--debitAlice=1/2Bob=1/2--creditAlice=1groupamountratepayeecategorydebtorscreditorsAliceBobAlice.wBob.wAlice.$Bob.$WhoDelta00$10.000GroceryStoreFood(Alice,Bob)(Bob)4006000.40.6$4.00$6.00-$0.0011$15.750RestaurantDinner(Alice,Bob)(Alice)7877870.50.5$7.87$7.88Alice-$0.01Add taxes and tips for the previous transactionbany>tip--amount5.00--categoryTipsgroupamountratepayeecategorydebtorscreditorsAliceBobAlice.wBob.wAlice.$Bob.$WhoDelta00$10.000.00000GroceryStoreFood(Alice,Bob)(Bob)4006000.40.6$4.00$6.00-$0.0011$15.750.00000RestaurantDinner(Alice,Bob)(Alice)7877870.50.5$7.87$7.88Alice-$0.0121$5.000.31746RestaurantTips(Alice,Bob)(Alice)2502500.50.5$2.50$2.50-$0.00bany>tax--rate0.07--payeeSalesTaxgroupamountratepayeecategorydebtorscreditorsAliceBobAlice.wBob.wAlice.$Bob.$WhoDelta00$10.000.00000GroceryStoreFood(Alice,Bob)(Bob)4006000.40.6$4.00$6.00-$0.0011$15.750.00000RestaurantDinner(Alice,Bob)(Alice)7877870.50.5$7.87$7.88Alice-$0.0121$5.000.31746RestaurantTips(Alice,Bob)(Alice)2502500.50.5$2.50$2.50-$0.0031$1.100.07000SalesTaxDinner(Alice,Bob)(Alice)55550.50.5$0.55$0.55-$0.00Display the current transactionsbany>showgroupamountratepayeecategorydebtorscreditorsAliceBobAlice.wBob.wAlice.$Bob.$WhoDelta00$10.000.00000GroceryStoreFood(Alice,Bob)(Bob)4006000.40.6$4.00$6.00-$0.0011$15.750.00000RestaurantDinner(Alice,Bob)(Alice)7877870.50.5$7.87$7.88Alice-$0.0121$5.000.31746RestaurantTips(Alice,Bob)(Alice)2502500.50.5$2.50$2.50-$0.0031$1.100.07000SalesTaxDinner(Alice,Bob)(Alice)55550.50.5$0.55$0.55-$0.00Aggregate by categories and peoplebany>summarizeamountcategorypayeeAlice.$Bob.$0$10.00FoodGroceryStore$4.00$6.001$15.75DinnerRestaurant$7.87$7.882$5.00TipsRestaurant$2.50$2.503$1.10DinnerSalesTax$0.55$0.55bany solveThis is a script to solve a math problem.I have a few investment funds and want them each to have a certain percent of my savings.I need to know which funds to put the money in to reach my desired allocation.We have a histogram and want to morph it into a new shapeGiven a set of labeled buckets with known item counts...Given a new amount of items to place into the buckets...Given a desired distribution of items for the buckets...How should we place the new items into the buckets?Examples# The problem will be solved in an unconstrained way by default# Values can be added or removed from existing binsbanysolveunconstrained--configallocate.yaml# The problem can be solved in a constrained way as well# Values can only be added to binsbanysolveconstrained--configallocate.yaml# A Monte Carlo based solver also exists, which is non-deterministic# Values can be added in fixed sizesbanysolvemontecarlo--configallocate.yaml--stepsize25Input DistributionTOTALlevel=[0]current_value=[6,000.00]optimal_ratio=[1.000]amount_to_add=[8,000.00]├─VIGAXlevel=[1]current_value=[1,000.00]optimal_ratio=[0.220]amount_to_add=[0.00]├─VVIAXlevel=[1]current_value=[1,000.00]optimal_ratio=[0.280]amount_to_add=[0.00]├─VMGMXlevel=[1]current_value=[1,000.00]optimal_ratio=[0.100]amount_to_add=[0.00]├─VMVAXlevel=[1]current_value=[1,000.00]optimal_ratio=[0.150]amount_to_add=[0.00]├─VSGAXlevel=[1]current_value=[1,000.00]optimal_ratio=[0.100]amount_to_add=[0.00]└─VSIAXlevel=[1]current_value=[1,000.00]optimal_ratio=[0.150]amount_to_add=[0.00]Output DistributionTOTALlevel=[0]results_value=[14,000.00]results_ratio=[1.000]amount_to_add=[0.00]├─VIGAXlevel=[1]results_value=[3,080.00]results_ratio=[0.220]amount_to_add=[2,080.00]├─VVIAXlevel=[1]results_value=[3,920.00]results_ratio=[0.280]amount_to_add=[2,920.00]├─VMGMXlevel=[1]results_value=[1,400.00]results_ratio=[0.100]amount_to_add=[400.00]├─VMVAXlevel=[1]results_value=[2,100.00]results_ratio=[0.150]amount_to_add=[1,100.00]├─VSGAXlevel=[1]results_value=[1,400.00]results_ratio=[0.100]amount_to_add=[400.00]└─VSIAXlevel=[1]results_value=[2,100.00]results_ratio=[0.150]amount_to_add=[1,100.00]config.yamlThe input is a hierarchy of bins with current values and desired ratios.yamlThe input can be given as a YAML file.-{label:'TOTAL',optimal_ratio:100,current_value:6000,amount_to_add:8000,children:['VIGAX','VVIAX','VMGMX','VMVAX','VSGAX','VSIAX']}-{label:'VIGAX',optimal_ratio:22,current_value:1000,amount_to_add:0,children:[]}-{label:'VVIAX',optimal_ratio:28,current_value:1000,amount_to_add:0,children:[]}-{label:'VMGMX',optimal_ratio:10,current_value:1000,amount_to_add:0,children:[]}-{label:'VMVAX',optimal_ratio:15,current_value:1000,amount_to_add:0,children:[]}-{label:'VSGAX',optimal_ratio:10,current_value:1000,amount_to_add:0,children:[]}-{label:'VSIAX',optimal_ratio:15,current_value:1000,amount_to_add:0,children:[]}You can use regular expressions when specifying the children of a category.-{label:'TOTAL',optimal_ratio:100,current_value:6000,amount_to_add:8000,children:['regex::.*']}...csvThe input can be given as a CSV file.label  optimal_ratio  current_value  amount_to_add                             children
0  TOTAL          100.0         6000.0         8000.0  VIGAX;VVIAX;VMGMX;VMVAX;VSGAX;VSIAX
1  VIGAX           22.0         1000.0            0.0
2  VVIAX           28.0         1000.0            0.0
3  VMGMX           10.0         1000.0            0.0
4  VMVAX           15.0         1000.0            0.0
5  VSGAX           10.0         1000.0            0.0
6  VSIAX           15.0         1000.0            0.0