From 0a212ac6ce1c0972405d111aa4ee57c224c430ed Mon Sep 17 00:00:00 2001 From: Anantha Kumaran Date: Sun, 11 Feb 2024 09:21:41 +0530 Subject: [PATCH] adjust dates --- internal/query/posting.go | 4 +- tests/fixture/inr-beancount/allocation.json | 2 +- .../fixture/inr-beancount/assets_balance.json | 4 +- tests/fixture/inr-beancount/dashboard.json | 48 ++-- tests/fixture/inr-beancount/expense.json | 12 +- tests/fixture/inr-beancount/files.json | 2 +- tests/fixture/inr-beancount/income.json | 12 +- tests/fixture/inr-beancount/ledger.json | 44 ++-- tests/fixture/inr-beancount/main.beancount | 6 +- tests/fixture/inr-beancount/networth.json | 8 +- tests/fixture/inr-beancount/transaction.json | 46 ++-- tests/fixture/inr-hledger/expense.json | 56 ++--- tests/fixture/inr-hledger/investment.json | 56 ++--- tests/fixture/inr-hledger/ledger.json | 36 +-- tests/fixture/inr/allocation.json | 23 +- tests/fixture/inr/assets_balance.json | 2 +- tests/fixture/inr/dashboard.json | 220 +++++++++--------- tests/fixture/inr/expense.json | 118 +++++----- tests/fixture/inr/files.json | 2 +- tests/fixture/inr/gain.json | 8 +- tests/fixture/inr/income.json | 4 +- tests/fixture/inr/investment.json | 84 +++---- tests/fixture/inr/ledger.json | 204 ++++++++-------- tests/fixture/inr/main.ledger | 6 +- tests/fixture/inr/networth.json | 22 +- tests/fixture/inr/price.json | 4 +- tests/fixture/inr/transaction.json | 218 ++++++++--------- 27 files changed, 618 insertions(+), 633 deletions(-) diff --git a/internal/query/posting.go b/internal/query/posting.go index 4d0a3804..2db65d0b 100644 --- a/internal/query/posting.go +++ b/internal/query/posting.go @@ -130,7 +130,7 @@ func (q *Query) All() []posting.Posting { var postings []posting.Posting q.context = q.context.Where("forecast = ?", q.includeForecast) - result := q.context.Order("date " + q.order + ", amount desc").Find(&postings) + result := q.context.Order("date " + q.order + ", amount desc, account asc").Find(&postings) if result.Error != nil { log.Fatal(result.Error) } @@ -140,7 +140,7 @@ func (q *Query) All() []posting.Posting { func (q *Query) First() *posting.Posting { var posting posting.Posting q.context = q.context.Where("forecast = ?", q.includeForecast) - result := q.context.Order("date " + q.order + ", amount desc").First(&posting) + result := q.context.Order("date " + q.order + ", amount desc, account asc").First(&posting) if result.Error != nil { if errors.Is(result.Error, gorm.ErrRecordNotFound) { diff --git a/tests/fixture/inr-beancount/allocation.json b/tests/fixture/inr-beancount/allocation.json index 93fc36c2..8d71449f 100644 --- a/tests/fixture/inr-beancount/allocation.json +++ b/tests/fixture/inr-beancount/allocation.json @@ -762,7 +762,7 @@ "Assets:Checking": { "date": "2022-01-29T00:00:00Z", "account": "Assets:Checking", - "market_amount": 11097.22810619763 + "market_amount": 12169.22810619763 }, "Assets:Coinbase:BTC": { "date": "2022-01-29T00:00:00Z", diff --git a/tests/fixture/inr-beancount/assets_balance.json b/tests/fixture/inr-beancount/assets_balance.json index e8b2e0ca..1211fba2 100644 --- a/tests/fixture/inr-beancount/assets_balance.json +++ b/tests/fixture/inr-beancount/assets_balance.json @@ -7,7 +7,7 @@ "marketAmount": 102155.81133819763, "balanceUnits": 0, "latestPrice": 0, - "xirr": 12.15, + "xirr": 12.14, "gainAmount": 13414.62810619763, "absoluteReturn": 0.1358193262974935 }, @@ -18,7 +18,7 @@ "marketAmount": 13169.22810619763, "balanceUnits": 0, "latestPrice": 0, - "xirr": 44.43, + "xirr": 44.37, "gainAmount": 13169.22810619763, "absoluteReturn": 0 }, diff --git a/tests/fixture/inr-beancount/dashboard.json b/tests/fixture/inr-beancount/dashboard.json index d8a42e68..5dfdabd4 100644 --- a/tests/fixture/inr-beancount/dashboard.json +++ b/tests/fixture/inr-beancount/dashboard.json @@ -86,18 +86,18 @@ "balanceUnits": 0, "netInvestmentAmount": 100972 }, - "xirr": 12.15 + "xirr": 12.14 }, "transactionSequences": [], "transactions": [ { - "id": "7de56ebcddef5b0fd2525c04178705d3", + "id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "postings": [ { "id": 25, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Assets:Checking", @@ -107,8 +107,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", @@ -118,7 +118,7 @@ }, { "id": 24, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Income:Interest:Checking", @@ -128,8 +128,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", @@ -140,20 +140,20 @@ ], "tag_recurring": "", "tag_period": "", - "beginLine": 66, - "endLine": 69, + "beginLine": 69, + "endLine": 72, "fileName": "main.beancount", "note": "" }, { - "id": "3262b6a59ca5bc147ceb6f7ee90955c7", - "date": "2022-01-30T00:00:00Z", + "id": "ab7ce9cc56fadc16bd1ed6e908d9aacf", + "date": "2022-01-29T00:00:00Z", "payee": "(Padding inserted for Balance of 21000 INR for difference 1072.7 INR)", "postings": [ { "id": 22, - "transaction_id": "3262b6a59ca5bc147ceb6f7ee90955c7", - "date": "2022-01-30T00:00:00Z", + "transaction_id": "ab7ce9cc56fadc16bd1ed6e908d9aacf", + "date": "2022-01-29T00:00:00Z", "payee": "(Padding inserted for Balance of 21000 INR for difference 1072.7 INR)", "account": "Assets:Checking", "commodity": "INR", @@ -173,8 +173,8 @@ }, { "id": 23, - "transaction_id": "3262b6a59ca5bc147ceb6f7ee90955c7", - "date": "2022-01-30T00:00:00Z", + "transaction_id": "ab7ce9cc56fadc16bd1ed6e908d9aacf", + "date": "2022-01-29T00:00:00Z", "payee": "(Padding inserted for Balance of 21000 INR for difference 1072.7 INR)", "account": "Equity:OpeningBalances", "commodity": "INR", @@ -206,13 +206,13 @@ "payee": "Purchased 0.00000001 BTC", "postings": [ { - "id": 20, + "id": 21, "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", "date": "2022-01-10T00:00:00Z", "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -0.00042772, "amount": 0, "status": "cleared", "tag_recurring": "", @@ -227,13 +227,13 @@ "balance": 0 }, { - "id": 21, + "id": 20, "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", "date": "2022-01-10T00:00:00Z", "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -0.00042772, + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, "amount": 0, "status": "cleared", "tag_recurring": "", diff --git a/tests/fixture/inr-beancount/expense.json b/tests/fixture/inr-beancount/expense.json index a9f55ed3..bd0589cd 100644 --- a/tests/fixture/inr-beancount/expense.json +++ b/tests/fixture/inr-beancount/expense.json @@ -322,7 +322,7 @@ }, { "id": 24, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Income:Interest:Checking", @@ -332,8 +332,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", @@ -589,7 +589,7 @@ }, { "id": 24, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Income:Interest:Checking", @@ -599,8 +599,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", diff --git a/tests/fixture/inr-beancount/files.json b/tests/fixture/inr-beancount/files.json index 535607bd..0c1b8690 100644 --- a/tests/fixture/inr-beancount/files.json +++ b/tests/fixture/inr-beancount/files.json @@ -24,7 +24,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 Expenses:Charges\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\n1970-01-01 open Assets:Dollar\n1970-01-01 open Equity:OpeningBalances\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-09 txn \"Multi Currency Debit\"\n Expenses:Charges 100 INR\n Assets:Dollar 10 USD\n Assets:Checking\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\n2022/01/30 pad Assets:Checking Equity:OpeningBalances\n2022/01/31 balance Assets:Checking 21000 INR\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 Expenses:Charges\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\n1970-01-01 open Assets:Dollar\n1970-01-01 open Equity:OpeningBalances\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-09 txn \"Multi Currency Debit\"\n Expenses:Charges 100 INR\n Assets:Dollar 10 USD\n Assets:Checking\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/29 pad Assets:Checking Equity:OpeningBalances\n2022/01/30 balance Assets:Checking 21000 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", "versions": [], "operation": "" } diff --git a/tests/fixture/inr-beancount/income.json b/tests/fixture/inr-beancount/income.json index a887e5ee..2f098bdc 100644 --- a/tests/fixture/inr-beancount/income.json +++ b/tests/fixture/inr-beancount/income.json @@ -68,7 +68,7 @@ }, { "id": 24, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Income:Interest:Checking", @@ -78,8 +78,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", @@ -165,7 +165,7 @@ }, { "id": 24, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Income:Interest:Checking", @@ -175,8 +175,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", diff --git a/tests/fixture/inr-beancount/ledger.json b/tests/fixture/inr-beancount/ledger.json index 48ac4115..c790f9e5 100644 --- a/tests/fixture/inr-beancount/ledger.json +++ b/tests/fixture/inr-beancount/ledger.json @@ -2,7 +2,7 @@ "postings": [ { "id": 24, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Income:Interest:Checking", @@ -12,8 +12,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", @@ -23,7 +23,7 @@ }, { "id": 25, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Assets:Checking", @@ -33,8 +33,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", @@ -44,8 +44,8 @@ }, { "id": 22, - "transaction_id": "3262b6a59ca5bc147ceb6f7ee90955c7", - "date": "2022-01-30T00:00:00Z", + "transaction_id": "ab7ce9cc56fadc16bd1ed6e908d9aacf", + "date": "2022-01-29T00:00:00Z", "payee": "(Padding inserted for Balance of 21000 INR for difference 1072.7 INR)", "account": "Assets:Checking", "commodity": "INR", @@ -65,8 +65,8 @@ }, { "id": 23, - "transaction_id": "3262b6a59ca5bc147ceb6f7ee90955c7", - "date": "2022-01-30T00:00:00Z", + "transaction_id": "ab7ce9cc56fadc16bd1ed6e908d9aacf", + "date": "2022-01-29T00:00:00Z", "payee": "(Padding inserted for Balance of 21000 INR for difference 1072.7 INR)", "account": "Equity:OpeningBalances", "commodity": "INR", @@ -85,13 +85,13 @@ "balance": -1072.7 }, { - "id": 21, + "id": 20, "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", "date": "2022-01-10T00:00:00Z", "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -0.00042772, + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, "amount": 0, "status": "cleared", "tag_recurring": "", @@ -102,17 +102,17 @@ "forecast": false, "note": "", "transaction_note": "", - "market_amount": -0.03440667277056, - "balance": 19817.53437228 + "market_amount": 0, + "balance": 1e-8 }, { - "id": 20, + "id": 21, "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", "date": "2022-01-10T00:00:00Z", "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -0.00042772, "amount": 0, "status": "cleared", "tag_recurring": "", @@ -123,8 +123,8 @@ "forecast": false, "note": "", "transaction_note": "", - "market_amount": 0, - "balance": 1e-8 + "market_amount": -0.03440667277056, + "balance": 19817.53437228 }, { "id": 15, diff --git a/tests/fixture/inr-beancount/main.beancount b/tests/fixture/inr-beancount/main.beancount index fd8b1cb5..763771ba 100644 --- a/tests/fixture/inr-beancount/main.beancount +++ b/tests/fixture/inr-beancount/main.beancount @@ -61,6 +61,9 @@ Assets:Coinbase:BTC 0.00000001 BTC {42772 USD} Assets:Checking -0.00042772 USD +2022/01/29 pad Assets:Checking Equity:OpeningBalances +2022/01/30 balance Assets:Checking 21000 INR + 2022-01-31 txn "Interest" ; Global note ; :interest: @@ -68,6 +71,3 @@ Assets:Checking 2022/01/31 balance Assets:Equity:NIFTY 800 NIFTY - -2022/01/30 pad Assets:Checking Equity:OpeningBalances -2022/01/31 balance Assets:Checking 21000 INR diff --git a/tests/fixture/inr-beancount/networth.json b/tests/fixture/inr-beancount/networth.json index 5b3d7687..6c3f40d7 100644 --- a/tests/fixture/inr-beancount/networth.json +++ b/tests/fixture/inr-beancount/networth.json @@ -254,12 +254,12 @@ }, { "date": "2022-01-29T00:00:00Z", - "investmentAmount": 228795.183232, + "investmentAmount": 229867.183232, "withdrawalAmount": 128895.183232, "gainAmount": -34.58866180237056, - "balanceAmount": 99865.41133819763, + "balanceAmount": 100937.41133819763, "balanceUnits": 0, - "netInvestmentAmount": 99900 + "netInvestmentAmount": 100972 }, { "date": "2022-01-30T00:00:00Z", @@ -343,5 +343,5 @@ "netInvestmentAmount": 100972 } ], - "xirr": 12.15 + "xirr": 12.14 } \ No newline at end of file diff --git a/tests/fixture/inr-beancount/transaction.json b/tests/fixture/inr-beancount/transaction.json index d1a5e9f7..db99b374 100644 --- a/tests/fixture/inr-beancount/transaction.json +++ b/tests/fixture/inr-beancount/transaction.json @@ -1,13 +1,13 @@ { "transactions": [ { - "id": "7de56ebcddef5b0fd2525c04178705d3", + "id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "postings": [ { "id": 25, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Assets:Checking", @@ -17,8 +17,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", @@ -28,7 +28,7 @@ }, { "id": 24, - "transaction_id": "7de56ebcddef5b0fd2525c04178705d3", + "transaction_id": "5e31c18d8b6da4f8b27ee2eee680e3ed", "date": "2022-01-31T00:00:00Z", "payee": "Interest", "account": "Income:Interest:Checking", @@ -38,8 +38,8 @@ "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 66, - "transaction_end_line": 69, + "transaction_begin_line": 69, + "transaction_end_line": 72, "file_name": "main.beancount", "forecast": false, "note": "", @@ -50,20 +50,20 @@ ], "tag_recurring": "", "tag_period": "", - "beginLine": 66, - "endLine": 69, + "beginLine": 69, + "endLine": 72, "fileName": "main.beancount", "note": "" }, { - "id": "3262b6a59ca5bc147ceb6f7ee90955c7", - "date": "2022-01-30T00:00:00Z", + "id": "ab7ce9cc56fadc16bd1ed6e908d9aacf", + "date": "2022-01-29T00:00:00Z", "payee": "(Padding inserted for Balance of 21000 INR for difference 1072.7 INR)", "postings": [ { "id": 22, - "transaction_id": "3262b6a59ca5bc147ceb6f7ee90955c7", - "date": "2022-01-30T00:00:00Z", + "transaction_id": "ab7ce9cc56fadc16bd1ed6e908d9aacf", + "date": "2022-01-29T00:00:00Z", "payee": "(Padding inserted for Balance of 21000 INR for difference 1072.7 INR)", "account": "Assets:Checking", "commodity": "INR", @@ -83,8 +83,8 @@ }, { "id": 23, - "transaction_id": "3262b6a59ca5bc147ceb6f7ee90955c7", - "date": "2022-01-30T00:00:00Z", + "transaction_id": "ab7ce9cc56fadc16bd1ed6e908d9aacf", + "date": "2022-01-29T00:00:00Z", "payee": "(Padding inserted for Balance of 21000 INR for difference 1072.7 INR)", "account": "Equity:OpeningBalances", "commodity": "INR", @@ -116,13 +116,13 @@ "payee": "Purchased 0.00000001 BTC", "postings": [ { - "id": 20, + "id": 21, "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", "date": "2022-01-10T00:00:00Z", "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Coinbase:BTC", - "commodity": "BTC", - "quantity": 1e-8, + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -0.00042772, "amount": 0, "status": "cleared", "tag_recurring": "", @@ -137,13 +137,13 @@ "balance": 0 }, { - "id": 21, + "id": 20, "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", "date": "2022-01-10T00:00:00Z", "payee": "Purchased 0.00000001 BTC", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -0.00042772, + "account": "Assets:Coinbase:BTC", + "commodity": "BTC", + "quantity": 1e-8, "amount": 0, "status": "cleared", "tag_recurring": "", diff --git a/tests/fixture/inr-hledger/expense.json b/tests/fixture/inr-hledger/expense.json index 5115d8a2..d3c8b859 100644 --- a/tests/fixture/inr-hledger/expense.json +++ b/tests/fixture/inr-hledger/expense.json @@ -396,19 +396,19 @@ "balance": 0 }, { - "id": 12, - "transaction_id": "6", + "id": 15, + "transaction_id": "9", "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, + "transaction_begin_line": 38, + "transaction_end_line": 41, "file_name": "main.ledger", "forecast": false, "note": "", @@ -417,19 +417,19 @@ "balance": 0 }, { - "id": 15, - "transaction_id": "9", + "id": 12, + "transaction_id": "6", "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 38, - "transaction_end_line": 41, + "transaction_begin_line": 26, + "transaction_end_line": 29, "file_name": "main.ledger", "forecast": false, "note": "", @@ -705,19 +705,19 @@ "balance": 0 }, { - "id": 12, - "transaction_id": "6", + "id": 15, + "transaction_id": "9", "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, + "transaction_begin_line": 38, + "transaction_end_line": 41, "file_name": "main.ledger", "forecast": false, "note": "", @@ -726,19 +726,19 @@ "balance": 0 }, { - "id": 15, - "transaction_id": "9", + "id": 12, + "transaction_id": "6", "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 38, - "transaction_end_line": 41, + "transaction_begin_line": 26, + "transaction_end_line": 29, "file_name": "main.ledger", "forecast": false, "note": "", diff --git a/tests/fixture/inr-hledger/investment.json b/tests/fixture/inr-hledger/investment.json index 9b00c621..cb8c6bbc 100644 --- a/tests/fixture/inr-hledger/investment.json +++ b/tests/fixture/inr-hledger/investment.json @@ -64,19 +64,19 @@ "balance": 0 }, { - "id": 12, - "transaction_id": "6", + "id": 15, + "transaction_id": "9", "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, + "transaction_begin_line": 38, + "transaction_end_line": 41, "file_name": "main.ledger", "forecast": false, "note": "", @@ -85,19 +85,19 @@ "balance": 0 }, { - "id": 15, - "transaction_id": "9", + "id": 12, + "transaction_id": "6", "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 38, - "transaction_end_line": 41, + "transaction_begin_line": 26, + "transaction_end_line": 29, "file_name": "main.ledger", "forecast": false, "note": "", @@ -238,19 +238,19 @@ "balance": 0 }, { - "id": 12, - "transaction_id": "6", + "id": 15, + "transaction_id": "9", "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, + "transaction_begin_line": 38, + "transaction_end_line": 41, "file_name": "main.ledger", "forecast": false, "note": "", @@ -259,19 +259,19 @@ "balance": 0 }, { - "id": 15, - "transaction_id": "9", + "id": 12, + "transaction_id": "6", "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 38, - "transaction_end_line": 41, + "transaction_begin_line": 26, + "transaction_end_line": 29, "file_name": "main.ledger", "forecast": false, "note": "", diff --git a/tests/fixture/inr-hledger/ledger.json b/tests/fixture/inr-hledger/ledger.json index ef8fdfc6..bbe30e2f 100644 --- a/tests/fixture/inr-hledger/ledger.json +++ b/tests/fixture/inr-hledger/ledger.json @@ -274,46 +274,46 @@ "balance": 40000 }, { - "id": 12, - "transaction_id": "6", + "id": 15, + "transaction_id": "9", "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, + "transaction_begin_line": 38, + "transaction_end_line": 41, "file_name": "main.ledger", "forecast": false, "note": "", "transaction_note": "", - "market_amount": 10027.3, - "balance": 800 + "market_amount": 10000, + "balance": 100 }, { - "id": 15, - "transaction_id": "9", + "id": 12, + "transaction_id": "6", "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", "quantity": 100, "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 38, - "transaction_end_line": 41, + "transaction_begin_line": 26, + "transaction_end_line": 29, "file_name": "main.ledger", "forecast": false, "note": "", "transaction_note": "", - "market_amount": 10000, - "balance": 100 + "market_amount": 10027.3, + "balance": 800 }, { "id": 14, diff --git a/tests/fixture/inr/allocation.json b/tests/fixture/inr/allocation.json index c33f54ac..bbb3b08a 100644 --- a/tests/fixture/inr/allocation.json +++ b/tests/fixture/inr/allocation.json @@ -95,12 +95,7 @@ "Assets:Checking": { "date": "2022-01-08T00:00:00Z", "account": "Assets:Checking", - "market_amount": 1974.6829928704 - }, - "Assets:Equity:AAPL": { - "date": "2022-01-08T00:00:00Z", - "account": "Assets:Equity:AAPL", - "market_amount": 10000 + "market_amount": 11974.6829928704 }, "Assets:Equity:ABNB": { "date": "2022-01-08T00:00:00Z", @@ -117,17 +112,12 @@ "Assets:Checking": { "date": "2022-01-09T00:00:00Z", "account": "Assets:Checking", - "market_amount": 11097.5625128704 - }, - "Assets:Dollar": { - "date": "2022-01-09T00:00:00Z", - "account": "Assets:Dollar", - "market_amount": 804.42048 + "market_amount": 1974.6829928704 }, "Assets:Equity:AAPL": { "date": "2022-01-09T00:00:00Z", "account": "Assets:Equity:AAPL", - "market_amount": 0 + "market_amount": 10000 }, "Assets:Equity:ABNB": { "date": "2022-01-09T00:00:00Z", @@ -144,12 +134,7 @@ "Assets:Checking": { "date": "2022-01-10T00:00:00Z", "account": "Assets:Checking", - "market_amount": 11097.5625128704 - }, - "Assets:Dollar": { - "date": "2022-01-10T00:00:00Z", - "account": "Assets:Dollar", - "market_amount": 804.42048 + "market_amount": 12001.9829928704 }, "Assets:Equity:AAPL": { "date": "2022-01-10T00:00:00Z", diff --git a/tests/fixture/inr/assets_balance.json b/tests/fixture/inr/assets_balance.json index 4f12ef85..ac1ce45f 100644 --- a/tests/fixture/inr/assets_balance.json +++ b/tests/fixture/inr/assets_balance.json @@ -18,7 +18,7 @@ "marketAmount": 12097.5625128704, "balanceUnits": 0, "latestPrice": 0, - "xirr": 48.56, + "xirr": 48.45, "gainAmount": 12097.5625128704, "absoluteReturn": 0 }, diff --git a/tests/fixture/inr/dashboard.json b/tests/fixture/inr/dashboard.json index f63b5a1c..ecd0cf90 100644 --- a/tests/fixture/inr/dashboard.json +++ b/tests/fixture/inr/dashboard.json @@ -55,7 +55,7 @@ { "id": 16, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -145,91 +145,15 @@ "fileName": "main.ledger", "note": " Global note\n :interest:" }, - { - "id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "postings": [ - { - "id": 15, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": 10027.3, - "amount": 10027.3, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 14, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Income:CapitalGains:Equity:AAPL", - "commodity": "INR", - "quantity": -27.3, - "amount": -27.3, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 13, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - } - ], - "tag_recurring": "", - "tag_period": "", - "beginLine": 30, - "endLine": 33, - "fileName": "main.ledger", - "note": "" - }, { "id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "postings": [ { "id": 17, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Dollar", "commodity": "USD", @@ -250,7 +174,7 @@ { "id": 16, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -271,7 +195,7 @@ { "id": 19, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Checking", "commodity": "USD", @@ -292,7 +216,7 @@ { "id": 18, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Checking", "commodity": "INR", @@ -319,24 +243,24 @@ "note": "" }, { - "id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy ABNB", + "id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", "postings": [ { - "id": 9, - "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy ABNB", - "account": "Assets:Equity:ABNB", - "commodity": "ABNB", - "quantity": 0.76, - "amount": 8025.3170071296, + "id": 15, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Assets:Checking", + "commodity": "INR", + "quantity": 10027.3, + "amount": 10027.3, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 22, - "transaction_end_line": 24, + "transaction_begin_line": 30, + "transaction_end_line": 33, "file_name": "main.ledger", "forecast": false, "note": "", @@ -345,19 +269,40 @@ "balance": 0 }, { - "id": 10, - "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy ABNB", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -99.7652, - "amount": -8025.3170071296, + "id": 14, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Income:CapitalGains:Equity:AAPL", + "commodity": "INR", + "quantity": -27.3, + "amount": -27.3, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 22, - "transaction_end_line": 24, + "transaction_begin_line": 30, + "transaction_end_line": 33, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 13, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 30, + "transaction_end_line": 33, "file_name": "main.ledger", "forecast": false, "note": "", @@ -368,20 +313,20 @@ ], "tag_recurring": "", "tag_period": "", - "beginLine": 22, - "endLine": 24, + "beginLine": 30, + "endLine": 33, "fileName": "main.ledger", "note": "" }, { "id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "postings": [ { "id": 11, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -402,7 +347,7 @@ { "id": 12, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Checking", "commodity": "INR", @@ -428,6 +373,61 @@ "fileName": "main.ledger", "note": "" }, + { + "id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", + "date": "2022-01-08T00:00:00Z", + "payee": "Buy ABNB", + "postings": [ + { + "id": 9, + "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", + "date": "2022-01-08T00:00:00Z", + "payee": "Buy ABNB", + "account": "Assets:Equity:ABNB", + "commodity": "ABNB", + "quantity": 0.76, + "amount": 8025.3170071296, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 22, + "transaction_end_line": 24, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 10, + "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", + "date": "2022-01-08T00:00:00Z", + "payee": "Buy ABNB", + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -99.7652, + "amount": -8025.3170071296, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 22, + "transaction_end_line": 24, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + } + ], + "tag_recurring": "", + "tag_period": "", + "beginLine": 22, + "endLine": 24, + "fileName": "main.ledger", + "note": "" + }, { "id": "928a326f-93b5-5967-96e8-fe18ad9bf45f", "date": "2022-01-07T00:00:00Z", diff --git a/tests/fixture/inr/expense.json b/tests/fixture/inr/expense.json index 2eadf00f..63a52dfb 100644 --- a/tests/fixture/inr/expense.json +++ b/tests/fixture/inr/expense.json @@ -24,7 +24,7 @@ { "id": 16, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -51,7 +51,7 @@ "name": "Assets:Checking" }, { - "id": 10, + "id": 13, "name": "Assets:Dollar" }, { @@ -71,7 +71,7 @@ "name": "Expenses" }, { - "id": 11, + "id": 14, "name": "Expenses:Charges" }, { @@ -83,15 +83,15 @@ "name": "Income" }, { - "id": 12, + "id": 10, "name": "Income:CapitalGains" }, { - "id": 13, + "id": 11, "name": "Income:CapitalGains:Equity" }, { - "id": 14, + "id": 12, "name": "Income:CapitalGains:Equity:AAPL" }, { @@ -134,7 +134,7 @@ }, { "source": 1, - "target": 10, + "target": 13, "value": 804.42048 }, { @@ -159,7 +159,7 @@ }, { "source": 5, - "target": 11, + "target": 14, "value": 100 }, { @@ -168,18 +168,18 @@ "value": 10000 }, { - "source": 12, + "source": 10, "target": 2, "value": 27.3 }, { - "source": 13, - "target": 12, + "source": 11, + "target": 10, "value": 27.3 }, { - "source": 14, - "target": 13, + "source": 12, + "target": 11, "value": 27.3 }, { @@ -222,7 +222,7 @@ { "id": 16, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -289,7 +289,7 @@ { "id": 14, "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -377,7 +377,7 @@ { "id": 11, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -396,19 +396,19 @@ "balance": 0 }, { - "id": 17, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, + "id": 13, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 35, - "transaction_end_line": 38, + "transaction_begin_line": 30, + "transaction_end_line": 33, "file_name": "main.ledger", "forecast": false, "note": "", @@ -417,19 +417,19 @@ "balance": 0 }, { - "id": 13, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "id": 17, + "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, + "transaction_begin_line": 35, + "transaction_end_line": 38, "file_name": "main.ledger", "forecast": false, "note": "", @@ -468,7 +468,7 @@ { "id": 16, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -535,7 +535,7 @@ { "id": 14, "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -623,7 +623,7 @@ { "id": 11, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -642,19 +642,19 @@ "balance": 0 }, { - "id": 17, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, + "id": 13, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 35, - "transaction_end_line": 38, + "transaction_begin_line": 30, + "transaction_end_line": 33, "file_name": "main.ledger", "forecast": false, "note": "", @@ -663,19 +663,19 @@ "balance": 0 }, { - "id": 13, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "id": 17, + "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, + "transaction_begin_line": 35, + "transaction_end_line": 38, "file_name": "main.ledger", "forecast": false, "note": "", diff --git a/tests/fixture/inr/files.json b/tests/fixture/inr/files.json index 352f1679..6c92fbdf 100644 --- a/tests/fixture/inr/files.json +++ b/tests/fixture/inr/files.json @@ -21,7 +21,7 @@ "files": [ { "name": "main.ledger", - "content": "commodity INR 9,99,99,999.00\n\nP 2022/01/07 00:00:00 NIFTY 100 INR\nP 2022/02/07 00:00:00 NIFTY 100.273 INR\n\n2022/01/01 Salary\n Income:Salary:Acme -100,000 INR\n Assets:Checking 100,000 INR\n\n2022/01/03 Rent\n Assets:Checking -20,000 INR\n Expenses:Rent\n\n2022/01/06 Bonus\n Income:Salary:Acme -20,000 INR\n Assets:Checking 20,000 INR\n\n2022/01/07 Investment\n Assets:Checking -80,000 INR\n Assets:Equity:NIFTY 800 NIFTY @ 100 INR\n\n2022/01/08 Buy ABNB\n Assets:Equity:ABNB 0.76 ABNB @ 131.27 USD\n Assets:Checking\n\n2022/01/08 Buy Apple\n Assets:Equity:AAPL 100 AAPL @ 100 INR\n Assets:Checking\n\n2022/01/09 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/09 Multi Currency Debit\n Expenses:Charges 100 INR\n Assets:Dollar 10 USD\n Assets:Checking\n\nP 2022/01/08 00:00:00 USD 80.442048 INR\n\n2022/01/31 Interest\n ; Global note\n ; :interest:\n Income:Interest:Checking -1,000 INR ; Posting note\n Assets:Checking\n\n2022/01/31 * Asset balance\n Assets:Equity:NIFTY =800 NIFTY\n", + "content": "commodity INR 9,99,99,999.00\n\nP 2022/01/07 00:00:00 NIFTY 100 INR\nP 2022/02/07 00:00:00 NIFTY 100.273 INR\n\n2022/01/01 Salary\n Income:Salary:Acme -100,000 INR\n Assets:Checking 100,000 INR\n\n2022/01/03 Rent\n Assets:Checking -20,000 INR\n Expenses:Rent\n\n2022/01/06 Bonus\n Income:Salary:Acme -20,000 INR\n Assets:Checking 20,000 INR\n\n2022/01/07 Investment\n Assets:Checking -80,000 INR\n Assets:Equity:NIFTY 800 NIFTY @ 100 INR\n\n2022/01/08 Buy ABNB\n Assets:Equity:ABNB 0.76 ABNB @ 131.27 USD\n Assets:Checking\n\n2022/01/09 Buy Apple\n Assets:Equity:AAPL 100 AAPL @ 100 INR\n Assets:Checking\n\n2022/01/10 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/11 Multi Currency Debit\n Expenses:Charges 100 INR\n Assets:Dollar 10 USD\n Assets:Checking\n\nP 2022/01/08 00:00:00 USD 80.442048 INR\n\n2022/01/31 Interest\n ; Global note\n ; :interest:\n Income:Interest:Checking -1,000 INR ; Posting note\n Assets:Checking\n\n2022/01/31 * Asset balance\n Assets:Equity:NIFTY =800 NIFTY\n", "versions": [], "operation": "" } diff --git a/tests/fixture/inr/gain.json b/tests/fixture/inr/gain.json index 5837e541..e0700a45 100644 --- a/tests/fixture/inr/gain.json +++ b/tests/fixture/inr/gain.json @@ -16,7 +16,7 @@ { "id": 17, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Dollar", "commodity": "USD", @@ -52,7 +52,7 @@ { "id": 11, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -73,7 +73,7 @@ { "id": 14, "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -94,7 +94,7 @@ { "id": 13, "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", diff --git a/tests/fixture/inr/income.json b/tests/fixture/inr/income.json index 5c78de33..77458d28 100644 --- a/tests/fixture/inr/income.json +++ b/tests/fixture/inr/income.json @@ -48,7 +48,7 @@ { "id": 14, "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -145,7 +145,7 @@ { "id": 14, "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", diff --git a/tests/fixture/inr/investment.json b/tests/fixture/inr/investment.json index 9a492acd..ceefa242 100644 --- a/tests/fixture/inr/investment.json +++ b/tests/fixture/inr/investment.json @@ -45,7 +45,7 @@ { "id": 11, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -64,19 +64,19 @@ "balance": 0 }, { - "id": 17, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, + "id": 13, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 35, - "transaction_end_line": 38, + "transaction_begin_line": 30, + "transaction_end_line": 33, "file_name": "main.ledger", "forecast": false, "note": "", @@ -85,19 +85,19 @@ "balance": 0 }, { - "id": 13, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "id": 17, + "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, + "transaction_begin_line": 35, + "transaction_end_line": 38, "file_name": "main.ledger", "forecast": false, "note": "", @@ -156,7 +156,7 @@ { "id": 11, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -175,19 +175,19 @@ "balance": 0 }, { - "id": 17, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, + "id": 13, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 35, - "transaction_end_line": 38, + "transaction_begin_line": 30, + "transaction_end_line": 33, "file_name": "main.ledger", "forecast": false, "note": "", @@ -196,19 +196,19 @@ "balance": 0 }, { - "id": 13, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, + "id": 17, + "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, + "transaction_begin_line": 35, + "transaction_end_line": 38, "file_name": "main.ledger", "forecast": false, "note": "", diff --git a/tests/fixture/inr/ledger.json b/tests/fixture/inr/ledger.json index 0d643859..9a8c1b72 100644 --- a/tests/fixture/inr/ledger.json +++ b/tests/fixture/inr/ledger.json @@ -42,31 +42,10 @@ "market_amount": 1000, "balance": 20817.5348 }, - { - "id": 18, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": -100, - "amount": -100, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 35, - "transaction_end_line": 38, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": -100, - "balance": 9800.2348 - }, { "id": 17, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Dollar", "commodity": "USD", @@ -84,31 +63,10 @@ "market_amount": 804.42048, "balance": 10 }, - { - "id": 15, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": 10027.3, - "amount": 10027.3, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 10027.3, - "balance": 19817.5348 - }, { "id": 16, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -129,7 +87,7 @@ { "id": 19, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Checking", "commodity": "USD", @@ -145,33 +103,33 @@ "note": "", "transaction_note": "", "market_amount": -804.42048, - "balance": 9790.2348 + "balance": 19817.5348 }, { - "id": 14, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Income:CapitalGains:Equity:AAPL", + "id": 18, + "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Checking", "commodity": "INR", - "quantity": -27.3, - "amount": -27.3, + "quantity": -100, + "amount": -100, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, + "transaction_begin_line": 35, + "transaction_end_line": 38, "file_name": "main.ledger", "forecast": false, "note": "", "transaction_note": "", - "market_amount": -27.3, - "balance": -27.3 + "market_amount": -100, + "balance": 19827.5348 }, { "id": 13, "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -190,30 +148,51 @@ "balance": 0 }, { - "id": 10, - "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy ABNB", + "id": 15, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", "account": "Assets:Checking", - "commodity": "USD", - "quantity": -99.7652, - "amount": -8025.3170071296, + "commodity": "INR", + "quantity": 10027.3, + "amount": 10027.3, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 22, - "transaction_end_line": 24, + "transaction_begin_line": 30, + "transaction_end_line": 33, "file_name": "main.ledger", "forecast": false, "note": "", "transaction_note": "", - "market_amount": -8025.3170071296, - "balance": 19900.2348 + "market_amount": 10027.3, + "balance": 19927.5348 + }, + { + "id": 14, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Income:CapitalGains:Equity:AAPL", + "commodity": "INR", + "quantity": -27.3, + "amount": -27.3, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 30, + "transaction_end_line": 33, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": -27.3, + "balance": -27.3 }, { "id": 12, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Checking", "commodity": "INR", @@ -232,14 +211,35 @@ "balance": 9900.2348 }, { - "id": 9, + "id": 11, + "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", + "date": "2022-01-09T00:00:00Z", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": 100, + "amount": 10000, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 26, + "transaction_end_line": 28, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 10027.3, + "balance": 100 + }, + { + "id": 10, "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", "date": "2022-01-08T00:00:00Z", "payee": "Buy ABNB", - "account": "Assets:Equity:ABNB", - "commodity": "ABNB", - "quantity": 0.76, - "amount": 8025.3170071296, + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -99.7652, + "amount": -8025.3170071296, "status": "unmarked", "tag_recurring": "", "tag_period": "", @@ -249,39 +249,39 @@ "forecast": false, "note": "", "transaction_note": "", - "market_amount": 8025.3170071296, - "balance": 0.76 + "market_amount": -8025.3170071296, + "balance": 19900.2348 }, { - "id": 11, - "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", + "id": 9, + "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": 100, - "amount": 10000, + "payee": "Buy ABNB", + "account": "Assets:Equity:ABNB", + "commodity": "ABNB", + "quantity": 0.76, + "amount": 8025.3170071296, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 28, + "transaction_begin_line": 22, + "transaction_end_line": 24, "file_name": "main.ledger", "forecast": false, "note": "", "transaction_note": "", - "market_amount": 10027.3, - "balance": 100 + "market_amount": 8025.3170071296, + "balance": 0.76 }, { - "id": 7, + "id": 8, "transaction_id": "928a326f-93b5-5967-96e8-fe18ad9bf45f", "date": "2022-01-07T00:00:00Z", "payee": "Investment", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": -80000, - "amount": -80000, + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", + "quantity": 800, + "amount": 80000, "status": "unmarked", "tag_recurring": "", "tag_period": "", @@ -291,18 +291,18 @@ "forecast": false, "note": "", "transaction_note": "", - "market_amount": -80000, - "balance": 20000 + "market_amount": 80218.4, + "balance": 800 }, { - "id": 8, + "id": 7, "transaction_id": "928a326f-93b5-5967-96e8-fe18ad9bf45f", "date": "2022-01-07T00:00:00Z", "payee": "Investment", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", - "quantity": 800, - "amount": 80000, + "account": "Assets:Checking", + "commodity": "INR", + "quantity": -80000, + "amount": -80000, "status": "unmarked", "tag_recurring": "", "tag_period": "", @@ -312,8 +312,8 @@ "forecast": false, "note": "", "transaction_note": "", - "market_amount": 80218.4, - "balance": 800 + "market_amount": -80000, + "balance": 20000 }, { "id": 6, diff --git a/tests/fixture/inr/main.ledger b/tests/fixture/inr/main.ledger index 24445965..f10f5349 100644 --- a/tests/fixture/inr/main.ledger +++ b/tests/fixture/inr/main.ledger @@ -23,16 +23,16 @@ P 2022/02/07 00:00:00 NIFTY 100.273 INR Assets:Equity:ABNB 0.76 ABNB @ 131.27 USD Assets:Checking -2022/01/08 Buy Apple +2022/01/09 Buy Apple Assets:Equity:AAPL 100 AAPL @ 100 INR Assets:Checking -2022/01/09 Sell +2022/01/10 Sell Assets:Equity:AAPL -100 AAPL {100 INR} @ 100.273 INR Income:CapitalGains:Equity:AAPL -27.3 INR Assets:Checking 10027.3 INR -2022/01/09 Multi Currency Debit +2022/01/11 Multi Currency Debit Expenses:Charges 100 INR Assets:Dollar 10 USD Assets:Checking diff --git a/tests/fixture/inr/networth.json b/tests/fixture/inr/networth.json index 0eb69362..ece472d6 100644 --- a/tests/fixture/inr/networth.json +++ b/tests/fixture/inr/networth.json @@ -65,8 +65,8 @@ }, { "date": "2022-01-08T00:00:00Z", - "investmentAmount": 218025.3170071296, - "withdrawalAmount": 118025.3170071296, + "investmentAmount": 208025.3170071296, + "withdrawalAmount": 108025.3170071296, "gainAmount": 0, "balanceAmount": 100000, "balanceUnits": 0, @@ -74,21 +74,21 @@ }, { "date": "2022-01-09T00:00:00Z", - "investmentAmount": 228857.0374871296, - "withdrawalAmount": 128957.0374871296, - "gainAmount": 27.3, - "balanceAmount": 99927.3, + "investmentAmount": 218025.3170071296, + "withdrawalAmount": 118025.3170071296, + "gainAmount": 0, + "balanceAmount": 100000, "balanceUnits": 0, - "netInvestmentAmount": 99900 + "netInvestmentAmount": 100000 }, { "date": "2022-01-10T00:00:00Z", - "investmentAmount": 228857.0374871296, - "withdrawalAmount": 128957.0374871296, + "investmentAmount": 228052.6170071296, + "withdrawalAmount": 128052.6170071296, "gainAmount": 27.3, - "balanceAmount": 99927.3, + "balanceAmount": 100027.3, "balanceUnits": 0, - "netInvestmentAmount": 99900 + "netInvestmentAmount": 100000 }, { "date": "2022-01-11T00:00:00Z", diff --git a/tests/fixture/inr/price.json b/tests/fixture/inr/price.json index 39b4b31c..caafc8c1 100644 --- a/tests/fixture/inr/price.json +++ b/tests/fixture/inr/price.json @@ -3,7 +3,7 @@ "AAPL": [ { "id": 5, - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "commodity_type": "unknown", "commodity_id": "AAPL", "commodity_name": "AAPL", @@ -11,7 +11,7 @@ }, { "id": 4, - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "commodity_type": "unknown", "commodity_id": "AAPL", "commodity_name": "AAPL", diff --git a/tests/fixture/inr/transaction.json b/tests/fixture/inr/transaction.json index bc00fb1e..3e29bcfa 100644 --- a/tests/fixture/inr/transaction.json +++ b/tests/fixture/inr/transaction.json @@ -55,91 +55,15 @@ "fileName": "main.ledger", "note": " Global note\n :interest:" }, - { - "id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "postings": [ - { - "id": 15, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": 10027.3, - "amount": 10027.3, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 14, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Income:CapitalGains:Equity:AAPL", - "commodity": "INR", - "quantity": -27.3, - "amount": -27.3, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 13, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, - "amount": -10000, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - } - ], - "tag_recurring": "", - "tag_period": "", - "beginLine": 30, - "endLine": 33, - "fileName": "main.ledger", - "note": "" - }, { "id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "postings": [ { "id": 17, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Dollar", "commodity": "USD", @@ -160,7 +84,7 @@ { "id": 16, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -181,7 +105,7 @@ { "id": 19, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Checking", "commodity": "USD", @@ -202,7 +126,7 @@ { "id": 18, "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Checking", "commodity": "INR", @@ -229,24 +153,24 @@ "note": "" }, { - "id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy ABNB", + "id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", "postings": [ { - "id": 9, - "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy ABNB", - "account": "Assets:Equity:ABNB", - "commodity": "ABNB", - "quantity": 0.76, - "amount": 8025.3170071296, + "id": 15, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Assets:Checking", + "commodity": "INR", + "quantity": 10027.3, + "amount": 10027.3, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 22, - "transaction_end_line": 24, + "transaction_begin_line": 30, + "transaction_end_line": 33, "file_name": "main.ledger", "forecast": false, "note": "", @@ -255,19 +179,40 @@ "balance": 0 }, { - "id": 10, - "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy ABNB", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -99.7652, - "amount": -8025.3170071296, + "id": 14, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Income:CapitalGains:Equity:AAPL", + "commodity": "INR", + "quantity": -27.3, + "amount": -27.3, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 22, - "transaction_end_line": 24, + "transaction_begin_line": 30, + "transaction_end_line": 33, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 13, + "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", + "quantity": -100, + "amount": -10000, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 30, + "transaction_end_line": 33, "file_name": "main.ledger", "forecast": false, "note": "", @@ -278,20 +223,20 @@ ], "tag_recurring": "", "tag_period": "", - "beginLine": 22, - "endLine": 24, + "beginLine": 30, + "endLine": 33, "fileName": "main.ledger", "note": "" }, { "id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "postings": [ { "id": 11, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -312,7 +257,7 @@ { "id": 12, "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Checking", "commodity": "INR", @@ -338,6 +283,61 @@ "fileName": "main.ledger", "note": "" }, + { + "id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", + "date": "2022-01-08T00:00:00Z", + "payee": "Buy ABNB", + "postings": [ + { + "id": 9, + "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", + "date": "2022-01-08T00:00:00Z", + "payee": "Buy ABNB", + "account": "Assets:Equity:ABNB", + "commodity": "ABNB", + "quantity": 0.76, + "amount": 8025.3170071296, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 22, + "transaction_end_line": 24, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 10, + "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", + "date": "2022-01-08T00:00:00Z", + "payee": "Buy ABNB", + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -99.7652, + "amount": -8025.3170071296, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 22, + "transaction_end_line": 24, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + } + ], + "tag_recurring": "", + "tag_period": "", + "beginLine": 22, + "endLine": 24, + "fileName": "main.ledger", + "note": "" + }, { "id": "928a326f-93b5-5967-96e8-fe18ad9bf45f", "date": "2022-01-07T00:00:00Z",