diff --git a/tests/fixture/inr-beancount/allocation.json b/tests/fixture/inr-beancount/allocation.json index 1031b6b1..9754df34 100644 --- a/tests/fixture/inr-beancount/allocation.json +++ b/tests/fixture/inr-beancount/allocation.json @@ -116,14 +116,8 @@ "Assets:Checking": { "date": "2022-01-08T00:00:00Z", "account": "Assets:Checking", - "amount": 1974.6485861976294, - "market_amount": 1974.6485861976294 - }, - "Assets:Coinbase:BTC": { - "date": "2022-01-08T00:00:00Z", - "account": "Assets:Coinbase:BTC", - "amount": 0.03440667277056, - "market_amount": 0.03440667277056 + "amount": 1974.6829928704, + "market_amount": 1974.6829928704 }, "Assets:Equity:AAPL": { "date": "2022-01-08T00:00:00Z", @@ -148,14 +142,8 @@ "Assets:Checking": { "date": "2022-01-09T00:00:00Z", "account": "Assets:Checking", - "amount": 12001.94858619763, - "market_amount": 12001.94858619763 - }, - "Assets:Coinbase:BTC": { - "date": "2022-01-09T00:00:00Z", - "account": "Assets:Coinbase:BTC", - "amount": 0.03440667277056, - "market_amount": 0.03440667277056 + "amount": 12001.9829928704, + "market_amount": 12001.9829928704 }, "Assets:Equity:AAPL": { "date": "2022-01-09T00:00:00Z", diff --git a/tests/fixture/inr-beancount/config.json b/tests/fixture/inr-beancount/config.json index c6982b14..70de254d 100644 --- a/tests/fixture/inr-beancount/config.json +++ b/tests/fixture/inr-beancount/config.json @@ -6,8 +6,8 @@ "Assets:Equity:NIFTY", "Assets:Equity:ABNB", "Assets:Equity:AAPL", - "Assets:Coinbase:BTC", "Income:CapitalGains:Equity:AAPL", + "Assets:Coinbase:BTC", "Income:Interest:Checking" ], "config": { diff --git a/tests/fixture/inr-beancount/dashboard.json b/tests/fixture/inr-beancount/dashboard.json index 946e680e..39bfaa1a 100644 --- a/tests/fixture/inr-beancount/dashboard.json +++ b/tests/fixture/inr-beancount/dashboard.json @@ -122,24 +122,24 @@ "note": "" }, { - "id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", + "id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", "postings": [ { - "id": 17, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": 10027.3, - "amount": 10027.3, + "id": 16, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, + "amount": 0.03440667277056, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 52, + "transaction_end_line": 55, "file_name": "main.beancount", "forecast": false, "note": "", @@ -148,74 +148,74 @@ "balance": 0 }, { - "id": 16, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Income:CapitalGains:Equity:AAPL", - "commodity": "INR", - "quantity": -27.3, - "amount": -27.3, + "id": 17, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -0.00042772, + "amount": -0.03440667277056, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 52, + "transaction_end_line": 55, "file_name": "main.beancount", "forecast": false, "note": "", "transaction_note": "", "market_amount": 0, "balance": 0 - }, + } + ], + "tag_recurring": "", + "tag_period": "", + "beginLine": 52, + "endLine": 55, + "fileName": "main.beancount", + "note": "" + }, + { + "id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "postings": [ { "id": 15, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "account": "Assets:Checking", + "commodity": "INR", + "quantity": 10027.3, + "amount": 10027.3, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", "transaction_note": "", "market_amount": 0, "balance": 0 - } - ], - "tag_recurring": "", - "tag_period": "", - "beginLine": 49, - "endLine": 53, - "fileName": "main.beancount", - "note": "" - }, - { - "id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "postings": [ + }, { - "id": 13, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, - "amount": 0.03440667277056, + "id": 14, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "account": "Income:CapitalGains:Equity:AAPL", + "commodity": "INR", + "quantity": -27.3, + "amount": -27.3, "status": "cleared", "tag_recurring": "", "tag_period": "", "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -224,19 +224,19 @@ "balance": 0 }, { - "id": 14, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -0.00042772, - "amount": -0.03440667277056, + "id": 13, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "cleared", "tag_recurring": "", "tag_period": "", "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -248,7 +248,7 @@ "tag_recurring": "", "tag_period": "", "beginLine": 45, - "endLine": 48, + "endLine": 49, "fileName": "main.beancount", "note": "" }, diff --git a/tests/fixture/inr-beancount/expense.json b/tests/fixture/inr-beancount/expense.json index 16d74024..68ccb885 100644 --- a/tests/fixture/inr-beancount/expense.json +++ b/tests/fixture/inr-beancount/expense.json @@ -30,7 +30,7 @@ "name": "Assets:Checking" }, { - "id": 10, + "id": 13, "name": "Assets:Coinbase:BTC" }, { @@ -58,15 +58,15 @@ "name": "Income" }, { - "id": 11, + "id": 10, "name": "Income:CapitalGains" }, { - "id": 12, + "id": 11, "name": "Income:CapitalGains:Equity" }, { - "id": 13, + "id": 12, "name": "Income:CapitalGains:Equity:AAPL" }, { @@ -133,18 +133,18 @@ "value": 10000 }, { - "source": 11, + "source": 10, "target": 2, "value": 27.3 }, { - "source": 12, - "target": 11, + "source": 11, + "target": 10, "value": 27.3 }, { - "source": 13, - "target": 12, + "source": 12, + "target": 11, "value": 27.3 }, { @@ -231,8 +231,8 @@ "balance": 0 }, { - "id": 16, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "id": 14, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", @@ -242,8 +242,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -341,18 +341,18 @@ }, { "id": 13, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, - "amount": 0.03440667277056, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "cleared", "tag_recurring": "", "tag_period": "", "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -361,19 +361,19 @@ "balance": 0 }, { - "id": 15, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "id": 16, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, + "amount": 0.03440667277056, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 52, + "transaction_end_line": 55, "file_name": "main.beancount", "forecast": false, "note": "", @@ -456,8 +456,8 @@ "balance": 0 }, { - "id": 16, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "id": 14, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", @@ -467,8 +467,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -566,18 +566,18 @@ }, { "id": 13, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, - "amount": 0.03440667277056, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "cleared", "tag_recurring": "", "tag_period": "", "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -586,19 +586,19 @@ "balance": 0 }, { - "id": 15, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "id": 16, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, + "amount": 0.03440667277056, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 52, + "transaction_end_line": 55, "file_name": "main.beancount", "forecast": false, "note": "", diff --git a/tests/fixture/inr-beancount/files.json b/tests/fixture/inr-beancount/files.json index c2d87302..9b9f5c43 100644 --- a/tests/fixture/inr-beancount/files.json +++ b/tests/fixture/inr-beancount/files.json @@ -6,8 +6,8 @@ "Assets:Equity:NIFTY", "Assets:Equity:ABNB", "Assets:Equity:AAPL", - "Assets:Coinbase:BTC", "Income:CapitalGains:Equity:AAPL", + "Assets:Coinbase:BTC", "Income:Interest:Checking" ], "commodities": [ @@ -21,7 +21,7 @@ "files": [ { "name": "main.beancount", - "content": "1970-01-01 open Assets:Checking\n1970-01-01 open Assets:Equity:AAPL\n1970-01-01 open Assets:Equity:ABNB\n1970-01-01 open Assets:Equity:NIFTY\n1970-01-01 open Expenses:Rent\n1970-01-01 open Income:CapitalGains:Equity:AAPL\n1970-01-01 open Income:Interest:Checking\n1970-01-01 open Income:Salary:Acme\n1970-01-01 open Assets:Coinbase:BTC\n\n1970-01-01 commodity AAPL\n1970-01-01 commodity ABNB\n1970-01-01 commodity INR\n1970-01-01 commodity NIFTY\n1970-01-01 commodity USD\n1970-01-01 commodity BTC\n\n2022-01-07 price NIFTY 100 INR\n2022-02-07 price NIFTY 100.273 INR\n\n2022-01-01 txn \"Salary\"\n Income:Salary:Acme -100,000 INR\n Assets:Checking 100,000 INR\n\n2022-01-03 txn \"Rent\"\n Assets:Checking -20,000 INR\n Expenses:Rent\n\n2022-01-06 txn \"Bonus\"\n Income:Salary:Acme -20,000 INR\n Assets:Checking 20,000 INR\n\n2022-01-07 txn \"Investment\"\n Assets:Checking -80,000 INR\n Assets:Equity:NIFTY 800 NIFTY {100 INR}\n\n2022-01-08 txn \"Buy ABNB\"\n Assets:Equity:ABNB 0.76 ABNB {131.27 USD}\n Assets:Checking\n\n2022-01-08 txn \"Buy Apple\"\n Assets:Equity:AAPL 100 AAPL {100 INR}\n Assets:Checking\n\n2022-01-08 txn \"Purchased 0.00000001 BTC\"\n Assets:Coinbase:BTC 0.00000001 BTC {42772 USD}\n Assets:Checking -0.00042772 USD\n\n2022-01-09 txn \"Sell\"\n Assets:Equity:AAPL -100 AAPL {100 INR} @ 100.273 INR\n Income:CapitalGains:Equity:AAPL -27.3 INR\n Assets:Checking 10027.3 INR\n\n2022-01-08 price USD 80.442048 INR\n\n2022-01-31 txn \"Interest\"\n ; Global note\n ; :interest:\n Income:Interest:Checking -1,000 INR ; Posting note\n Assets:Checking\n\n2022/01/31 balance Assets:Equity:NIFTY 800 NIFTY\n", + "content": "1970-01-01 open Assets:Checking\n1970-01-01 open Assets:Equity:AAPL\n1970-01-01 open Assets:Equity:ABNB\n1970-01-01 open Assets:Equity:NIFTY\n1970-01-01 open Expenses:Rent\n1970-01-01 open Income:CapitalGains:Equity:AAPL\n1970-01-01 open Income:Interest:Checking\n1970-01-01 open Income:Salary:Acme\n1970-01-01 open Assets:Coinbase:BTC\n\n1970-01-01 commodity AAPL\n1970-01-01 commodity ABNB\n1970-01-01 commodity INR\n1970-01-01 commodity NIFTY\n1970-01-01 commodity USD\n1970-01-01 commodity BTC\n\n2022-01-07 price NIFTY 100 INR\n2022-02-07 price NIFTY 100.273 INR\n\n2022-01-01 txn \"Salary\"\n Income:Salary:Acme -100,000 INR\n Assets:Checking 100,000 INR\n\n2022-01-03 txn \"Rent\"\n Assets:Checking -20,000 INR\n Expenses:Rent\n\n2022-01-06 txn \"Bonus\"\n Income:Salary:Acme -20,000 INR\n Assets:Checking 20,000 INR\n\n2022-01-07 txn \"Investment\"\n Assets:Checking -80,000 INR\n Assets:Equity:NIFTY 800 NIFTY {100 INR}\n\n2022-01-08 txn \"Buy ABNB\"\n Assets:Equity:ABNB 0.76 ABNB {131.27 USD}\n Assets:Checking\n\n2022-01-08 txn \"Buy Apple\"\n Assets:Equity:AAPL 100 AAPL {100 INR}\n Assets:Checking\n\n2022-01-09 txn \"Sell\"\n Assets:Equity:AAPL -100 AAPL {100 INR} @ 100.273 INR\n Income:CapitalGains:Equity:AAPL -27.3 INR\n Assets:Checking 10027.3 INR\n\n2022-01-08 price USD 80.442048 INR\n\n2022-01-10 txn \"Purchased 0.00000001 BTC\"\n Assets:Coinbase:BTC 0.00000001 BTC {42772 USD}\n Assets:Checking -0.00042772 USD\n\n2022-01-31 txn \"Interest\"\n ; Global note\n ; :interest:\n Income:Interest:Checking -1,000 INR ; Posting note\n Assets:Checking\n\n2022/01/31 balance Assets:Equity:NIFTY 800 NIFTY\n", "versions": [], "operation": "" } @@ -33,8 +33,8 @@ "Investment", "Buy ABNB", "Buy Apple", - "Purchased 0.00000001 BTC", "Sell", + "Purchased 0.00000001 BTC", "Interest" ] } \ No newline at end of file diff --git a/tests/fixture/inr-beancount/gain.json b/tests/fixture/inr-beancount/gain.json index d62064ad..b230b9c3 100644 --- a/tests/fixture/inr-beancount/gain.json +++ b/tests/fixture/inr-beancount/gain.json @@ -14,9 +14,9 @@ "xirr": 0, "postings": [ { - "id": 13, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", + "id": 16, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "account": "Assets:Coinbase:BTC", "commodity": "BTC", @@ -25,8 +25,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_begin_line": 52, + "transaction_end_line": 55, "file_name": "main.beancount", "forecast": false, "note": "", @@ -71,8 +71,8 @@ "balance": 0 }, { - "id": 16, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "id": 14, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", @@ -82,8 +82,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -92,8 +92,8 @@ "balance": 0 }, { - "id": 15, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "id": 13, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", @@ -103,8 +103,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", diff --git a/tests/fixture/inr-beancount/income.json b/tests/fixture/inr-beancount/income.json index 5b5a5c07..a9a7ee86 100644 --- a/tests/fixture/inr-beancount/income.json +++ b/tests/fixture/inr-beancount/income.json @@ -46,8 +46,8 @@ "balance": 0 }, { - "id": 16, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "id": 14, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", @@ -57,8 +57,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -143,8 +143,8 @@ "balance": 0 }, { - "id": 16, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "id": 14, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", @@ -154,8 +154,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", diff --git a/tests/fixture/inr-beancount/investment.json b/tests/fixture/inr-beancount/investment.json index a82edf6f..58f2500c 100644 --- a/tests/fixture/inr-beancount/investment.json +++ b/tests/fixture/inr-beancount/investment.json @@ -65,18 +65,18 @@ }, { "id": 13, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, - "amount": 0.03440667277056, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "cleared", "tag_recurring": "", "tag_period": "", "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -85,19 +85,19 @@ "balance": 0 }, { - "id": 15, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "id": 16, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, + "amount": 0.03440667277056, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 52, + "transaction_end_line": 55, "file_name": "main.beancount", "forecast": false, "note": "", @@ -176,18 +176,18 @@ }, { "id": 13, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, - "amount": 0.03440667277056, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "cleared", "tag_recurring": "", "tag_period": "", "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -196,19 +196,19 @@ "balance": 0 }, { - "id": 15, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "id": 16, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, + "amount": 0.03440667277056, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 52, + "transaction_end_line": 55, "file_name": "main.beancount", "forecast": false, "note": "", diff --git a/tests/fixture/inr-beancount/ledger.json b/tests/fixture/inr-beancount/ledger.json index 9c67040e..f7a65266 100644 --- a/tests/fixture/inr-beancount/ledger.json +++ b/tests/fixture/inr-beancount/ledger.json @@ -43,8 +43,50 @@ "balance": 20927.53437228 }, { - "id": 15, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "id": 16, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, + "amount": 0.03440667277056, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 52, + "transaction_end_line": 55, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0.03440667277056, + "balance": 1e-8 + }, + { + "id": 17, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -0.00042772, + "amount": -0.03440667277056, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 52, + "transaction_end_line": 55, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": -0.03440667277056, + "balance": 19927.53437228 + }, + { + "id": 13, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", @@ -54,8 +96,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -64,8 +106,8 @@ "balance": 0 }, { - "id": 17, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "id": 15, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", "account": "Assets:Checking", @@ -75,18 +117,18 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", "transaction_note": "", "market_amount": 10027.3, - "balance": 19927.53437228 + "balance": 19927.5348 }, { - "id": 16, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "id": 14, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", @@ -96,8 +138,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -126,27 +168,6 @@ "market_amount": 10000, "balance": 100 }, - { - "id": 9, - "transaction_id": "c1b0e83e369be2f6b1ad089b3b62f337", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy ABNB", - "account": "Assets:Equity:ABNB", - "commodity": "ABNB", - "quantity": 0.76, - "amount": 8025.3170071296, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 37, - "transaction_end_line": 40, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 8025.3170071296, - "balance": 0.76 - }, { "id": 10, "transaction_id": "c1b0e83e369be2f6b1ad089b3b62f337", @@ -190,46 +211,25 @@ "balance": 9900.2348 }, { - "id": 14, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -0.00042772, - "amount": -0.03440667277056, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 45, - "transaction_end_line": 48, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": -0.03440667277056, - "balance": 9900.23437228 - }, - { - "id": 13, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", + "id": 9, + "transaction_id": "c1b0e83e369be2f6b1ad089b3b62f337", "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, - "amount": 0.03440667277056, + "payee": "Buy ABNB", + "account": "Assets:Equity:ABNB", + "commodity": "ABNB", + "quantity": 0.76, + "amount": 8025.3170071296, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_begin_line": 37, + "transaction_end_line": 40, "file_name": "main.beancount", "forecast": false, "note": "", "transaction_note": "", - "market_amount": 0.03440667277056, - "balance": 1e-8 + "market_amount": 8025.3170071296, + "balance": 0.76 }, { "id": 7, @@ -274,14 +274,14 @@ "balance": 800 }, { - "id": 5, + "id": 6, "transaction_id": "ad18f7219d2dfae9b6eccaca4a50ae8a", "date": "2022-01-06T00:00:00Z", "payee": "Bonus", - "account": "Income:Salary:Acme", + "account": "Assets:Checking", "commodity": "INR", - "quantity": -20000, - "amount": -20000, + "quantity": 20000, + "amount": 20000, "status": "cleared", "tag_recurring": "", "tag_period": "", @@ -291,18 +291,18 @@ "forecast": false, "note": "", "transaction_note": "", - "market_amount": -20000, - "balance": -120000 + "market_amount": 20000, + "balance": 100000 }, { - "id": 6, + "id": 5, "transaction_id": "ad18f7219d2dfae9b6eccaca4a50ae8a", "date": "2022-01-06T00:00:00Z", "payee": "Bonus", - "account": "Assets:Checking", + "account": "Income:Salary:Acme", "commodity": "INR", - "quantity": 20000, - "amount": 20000, + "quantity": -20000, + "amount": -20000, "status": "cleared", "tag_recurring": "", "tag_period": "", @@ -312,8 +312,8 @@ "forecast": false, "note": "", "transaction_note": "", - "market_amount": 20000, - "balance": 100000 + "market_amount": -20000, + "balance": -120000 }, { "id": 4, diff --git a/tests/fixture/inr-beancount/main.beancount b/tests/fixture/inr-beancount/main.beancount index 785ff1b3..ea4fdc35 100644 --- a/tests/fixture/inr-beancount/main.beancount +++ b/tests/fixture/inr-beancount/main.beancount @@ -42,10 +42,6 @@ Assets:Equity:AAPL 100 AAPL {100 INR} Assets:Checking -2022-01-08 txn "Purchased 0.00000001 BTC" - Assets:Coinbase:BTC 0.00000001 BTC {42772 USD} - Assets:Checking -0.00042772 USD - 2022-01-09 txn "Sell" Assets:Equity:AAPL -100 AAPL {100 INR} @ 100.273 INR Income:CapitalGains:Equity:AAPL -27.3 INR @@ -53,6 +49,10 @@ 2022-01-08 price USD 80.442048 INR +2022-01-10 txn "Purchased 0.00000001 BTC" + Assets:Coinbase:BTC 0.00000001 BTC {42772 USD} + Assets:Checking -0.00042772 USD + 2022-01-31 txn "Interest" ; Global note ; :interest: diff --git a/tests/fixture/inr-beancount/networth.json b/tests/fixture/inr-beancount/networth.json index e4e6de67..d14cc7b0 100644 --- a/tests/fixture/inr-beancount/networth.json +++ b/tests/fixture/inr-beancount/networth.json @@ -65,8 +65,8 @@ }, { "date": "2022-01-08T00:00:00Z", - "investmentAmount": 218025.35141380236, - "withdrawalAmount": 118025.35141380237, + "investmentAmount": 218025.3170071296, + "withdrawalAmount": 118025.3170071296, "gainAmount": 0, "balanceAmount": 100000, "balanceUnits": 0, @@ -74,8 +74,8 @@ }, { "date": "2022-01-09T00:00:00Z", - "investmentAmount": 228052.65141380238, - "withdrawalAmount": 128052.65141380238, + "investmentAmount": 228052.6170071296, + "withdrawalAmount": 128052.6170071296, "gainAmount": 27.3, "balanceAmount": 100027.3, "balanceUnits": 0, diff --git a/tests/fixture/inr-beancount/transaction.json b/tests/fixture/inr-beancount/transaction.json index 010f8482..f3dc98f9 100644 --- a/tests/fixture/inr-beancount/transaction.json +++ b/tests/fixture/inr-beancount/transaction.json @@ -56,24 +56,24 @@ "note": "" }, { - "id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", + "id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", "postings": [ { - "id": 17, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": 10027.3, - "amount": 10027.3, + "id": 16, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, + "amount": 0.03440667277056, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 52, + "transaction_end_line": 55, "file_name": "main.beancount", "forecast": false, "note": "", @@ -82,74 +82,74 @@ "balance": 0 }, { - "id": 16, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Income:CapitalGains:Equity:AAPL", - "commodity": "INR", - "quantity": -27.3, - "amount": -27.3, + "id": 17, + "transaction_id": "04bcc4e3077a15d78cf9e39b7acf7365", + "date": "2022-01-10T00:00:00Z", + "payee": "Purchased 0.00000001 BTC", + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -0.00042772, + "amount": -0.03440667277056, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 52, + "transaction_end_line": 55, "file_name": "main.beancount", "forecast": false, "note": "", "transaction_note": "", "market_amount": 0, "balance": 0 - }, + } + ], + "tag_recurring": "", + "tag_period": "", + "beginLine": 52, + "endLine": 55, + "fileName": "main.beancount", + "note": "" + }, + { + "id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "postings": [ { "id": 15, - "transaction_id": "cf0433d80755efdea68d26506e86dc65", + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", "date": "2022-01-09T00:00:00Z", "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "account": "Assets:Checking", + "commodity": "INR", + "quantity": 10027.3, + "amount": 10027.3, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 49, - "transaction_end_line": 53, + "transaction_begin_line": 45, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", "transaction_note": "", "market_amount": 0, "balance": 0 - } - ], - "tag_recurring": "", - "tag_period": "", - "beginLine": 49, - "endLine": 53, - "fileName": "main.beancount", - "note": "" - }, - { - "id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "postings": [ + }, { - "id": 13, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, - "amount": 0.03440667277056, + "id": 14, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "account": "Income:CapitalGains:Equity:AAPL", + "commodity": "INR", + "quantity": -27.3, + "amount": -27.3, "status": "cleared", "tag_recurring": "", "tag_period": "", "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -158,19 +158,19 @@ "balance": 0 }, { - "id": 14, - "transaction_id": "e0d3d39f83b50668b92ad25aac88582c", - "date": "2022-01-08T00:00:00Z", - "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -0.00042772, - "amount": -0.03440667277056, + "id": 13, + "transaction_id": "f94666a5e00e6fb7fde74aa1c3990f7f", + "date": "2022-01-09T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "cleared", "tag_recurring": "", "tag_period": "", "transaction_begin_line": 45, - "transaction_end_line": 48, + "transaction_end_line": 49, "file_name": "main.beancount", "forecast": false, "note": "", @@ -182,7 +182,7 @@ "tag_recurring": "", "tag_period": "", "beginLine": 45, - "endLine": 48, + "endLine": 49, "fileName": "main.beancount", "note": "" },