From 62401a43d4affb76c557339aea3972da90ee9b36 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 | 113 +++---- .../fixture/inr-beancount/assets_balance.json | 4 +- tests/fixture/inr-beancount/dashboard.json | 312 +++++++++--------- tests/fixture/inr-beancount/expense.json | 164 ++++----- tests/fixture/inr-beancount/files.json | 2 +- tests/fixture/inr-beancount/gain.json | 20 +- tests/fixture/inr-beancount/income.json | 20 +- tests/fixture/inr-beancount/investment.json | 108 +++--- tests/fixture/inr-beancount/ledger.json | 204 ++++++------ tests/fixture/inr-beancount/main.beancount | 14 +- tests/fixture/inr-beancount/networth.json | 40 +-- tests/fixture/inr-beancount/transaction.json | 306 ++++++++--------- tests/fixture/inr-hledger/expense.json | 84 ++--- tests/fixture/inr-hledger/investment.json | 84 ++--- tests/fixture/inr-hledger/ledger.json | 42 +-- tests/fixture/inr/allocation.json | 53 ++- tests/fixture/inr/assets_balance.json | 2 +- tests/fixture/inr/dashboard.json | 242 +++++++------- tests/fixture/inr/expense.json | 126 +++---- tests/fixture/inr/files.json | 2 +- tests/fixture/inr/gain.json | 8 +- tests/fixture/inr/income.json | 4 +- tests/fixture/inr/investment.json | 92 +++--- tests/fixture/inr/ledger.json | 222 ++++++------- tests/fixture/inr/main.ledger | 6 +- tests/fixture/inr/networth.json | 26 +- tests/fixture/inr/price.json | 4 +- tests/fixture/inr/transaction.json | 240 +++++++------- 29 files changed, 1254 insertions(+), 1294 deletions(-) diff --git a/internal/query/posting.go b/internal/query/posting.go index 4d0a380..2db65d0 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 93fc36c..d95c370 100644 --- a/tests/fixture/inr-beancount/allocation.json +++ b/tests/fixture/inr-beancount/allocation.json @@ -105,94 +105,69 @@ "Assets:Checking": { "date": "2022-01-08T00:00:00Z", "account": "Assets:Checking", + "market_amount": 11974.6829928704 + }, + "Assets:Equity:ABNB": { + "date": "2022-01-08T00:00:00Z", + "account": "Assets:Equity:ABNB", + "market_amount": 7963.762752 + }, + "Assets:Equity:NIFTY": { + "date": "2022-01-08T00:00:00Z", + "account": "Assets:Equity:NIFTY", + "market_amount": 80000 + } + }, + { + "Assets:Checking": { + "date": "2022-01-09T00:00:00Z", + "account": "Assets:Checking", "market_amount": 1974.6829928704 }, "Assets:Equity:AAPL": { - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "account": "Assets:Equity:AAPL", "market_amount": 10000 }, "Assets:Equity:ABNB": { - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "account": "Assets:Equity:ABNB", "market_amount": 7963.762752 }, "Assets:Equity:NIFTY": { - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "account": "Assets:Equity:NIFTY", "market_amount": 80000 } }, { "Assets:Checking": { - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", + "account": "Assets:Checking", + "market_amount": 12001.6829928704 + }, + "Assets:Equity:AAPL": { + "date": "2022-01-10T00:00:00Z", + "account": "Assets:Equity:AAPL", + "market_amount": 0 + }, + "Assets:Equity:ABNB": { + "date": "2022-01-10T00:00:00Z", + "account": "Assets:Equity:ABNB", + "market_amount": 7963.762752 + }, + "Assets:Equity:NIFTY": { + "date": "2022-01-10T00:00:00Z", + "account": "Assets:Equity:NIFTY", + "market_amount": 80000 + } + }, + { + "Assets:Checking": { + "date": "2022-01-11T00:00:00Z", "account": "Assets:Checking", "market_amount": 11097.2625128704 }, - "Assets:Dollar": { - "date": "2022-01-09T00:00:00Z", - "account": "Assets:Dollar", - "market_amount": 804.42048 - }, - "Assets:Equity:AAPL": { - "date": "2022-01-09T00:00:00Z", - "account": "Assets:Equity:AAPL", - "market_amount": 0 - }, - "Assets:Equity:ABNB": { - "date": "2022-01-09T00:00:00Z", - "account": "Assets:Equity:ABNB", - "market_amount": 7963.762752 - }, - "Assets:Equity:NIFTY": { - "date": "2022-01-09T00:00:00Z", - "account": "Assets:Equity:NIFTY", - "market_amount": 80000 - } - }, - { - "Assets:Checking": { - "date": "2022-01-10T00:00:00Z", - "account": "Assets:Checking", - "market_amount": 11097.22810619763 - }, - "Assets:Coinbase:BTC": { - "date": "2022-01-10T00:00:00Z", - "account": "Assets:Coinbase:BTC", - "market_amount": 0 - }, - "Assets:Dollar": { - "date": "2022-01-10T00:00:00Z", - "account": "Assets:Dollar", - "market_amount": 804.42048 - }, - "Assets:Equity:AAPL": { - "date": "2022-01-10T00:00:00Z", - "account": "Assets:Equity:AAPL", - "market_amount": 0 - }, - "Assets:Equity:ABNB": { - "date": "2022-01-10T00:00:00Z", - "account": "Assets:Equity:ABNB", - "market_amount": 7963.762752 - }, - "Assets:Equity:NIFTY": { - "date": "2022-01-10T00:00:00Z", - "account": "Assets:Equity:NIFTY", - "market_amount": 80000 - } - }, - { - "Assets:Checking": { - "date": "2022-01-11T00:00:00Z", - "account": "Assets:Checking", - "market_amount": 11097.22810619763 - }, - "Assets:Coinbase:BTC": { - "date": "2022-01-11T00:00:00Z", - "account": "Assets:Coinbase:BTC", - "market_amount": 0 - }, "Assets:Dollar": { "date": "2022-01-11T00:00:00Z", "account": "Assets:Dollar", @@ -762,7 +737,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 e8b2e0c..28a0901 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.27, "gainAmount": 13169.22810619763, "absoluteReturn": 0 }, diff --git a/tests/fixture/inr-beancount/dashboard.json b/tests/fixture/inr-beancount/dashboard.json index d8a42e6..4c1e9c4 100644 --- a/tests/fixture/inr-beancount/dashboard.json +++ b/tests/fixture/inr-beancount/dashboard.json @@ -54,8 +54,8 @@ }, { "id": 16, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -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", @@ -201,18 +201,18 @@ "note": "" }, { - "id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "postings": [ { - "id": 20, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "id": 21, + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00: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, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "id": 20, + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00: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": "", @@ -256,14 +256,111 @@ "note": "" }, { - "id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "postings": [ + { + "id": 18, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 16, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Expenses:Charges", + "commodity": "INR", + "quantity": 100, + "amount": 100, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 19, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -10, + "amount": -804.42048, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 17, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Checking", + "commodity": "INR", + "quantity": -100, + "amount": -100, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + } + ], + "tag_recurring": "", + "tag_period": "", + "beginLine": 55, + "endLine": 59, + "fileName": "main.beancount", + "note": "" + }, + { + "id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "postings": [ { "id": 15, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Checking", "commodity": "INR", @@ -283,8 +380,8 @@ }, { "id": 14, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -304,8 +401,8 @@ }, { "id": 13, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -332,45 +429,24 @@ "note": "" }, { - "id": "4bb9978f0b460e697351755e71548110", + "id": "bb27c9f651527e62d2528e13b9fb7c8b", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", + "payee": "Buy Apple", "postings": [ { - "id": 18, - "transaction_id": "4bb9978f0b460e697351755e71548110", + "id": 11, + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 16, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Expenses:Charges", - "commodity": "INR", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", "quantity": 100, - "amount": 100, + "amount": 10000, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, + "transaction_begin_line": 44, + "transaction_end_line": 47, "file_name": "main.beancount", "forecast": false, "note": "", @@ -379,40 +455,19 @@ "balance": 0 }, { - "id": 19, - "transaction_id": "4bb9978f0b460e697351755e71548110", + "id": 12, + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -10, - "amount": -804.42048, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 17, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", + "payee": "Buy Apple", "account": "Assets:Checking", "commodity": "INR", - "quantity": -100, - "amount": -100, + "quantity": -10000, + "amount": -10000, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, + "transaction_begin_line": 44, + "transaction_end_line": 47, "file_name": "main.beancount", "forecast": false, "note": "", @@ -423,8 +478,8 @@ ], "tag_recurring": "", "tag_period": "", - "beginLine": 55, - "endLine": 59, + "beginLine": 44, + "endLine": 47, "fileName": "main.beancount", "note": "" }, @@ -483,61 +538,6 @@ "fileName": "main.beancount", "note": "" }, - { - "id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "postings": [ - { - "id": 11, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": 100, - "amount": 10000, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 44, - "transaction_end_line": 47, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 12, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": -10000, - "amount": -10000, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 44, - "transaction_end_line": 47, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - } - ], - "tag_recurring": "", - "tag_period": "", - "beginLine": 44, - "endLine": 47, - "fileName": "main.beancount", - "note": "" - }, { "id": "d14e425ba0d573ba0388d100bda5eb80", "date": "2022-01-07T00:00:00Z", diff --git a/tests/fixture/inr-beancount/expense.json b/tests/fixture/inr-beancount/expense.json index a9f55ed..6738ee4 100644 --- a/tests/fixture/inr-beancount/expense.json +++ b/tests/fixture/inr-beancount/expense.json @@ -23,8 +23,8 @@ }, { "id": 16, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -55,7 +55,7 @@ "name": "Assets:Coinbase:BTC" }, { - "id": 10, + "id": 13, "name": "Assets:Dollar" }, { @@ -79,7 +79,7 @@ "name": "Expenses" }, { - "id": 11, + "id": 14, "name": "Expenses:Charges" }, { @@ -91,15 +91,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" }, { @@ -142,7 +142,7 @@ }, { "source": 1, - "target": 10, + "target": 13, "value": 804.42048 }, { @@ -167,7 +167,7 @@ }, { "source": 5, - "target": 11, + "target": 14, "value": 100 }, { @@ -176,18 +176,18 @@ "value": 10000 }, { - "source": 12, + "source": 10, "target": 2, "value": 27 }, { - "source": 13, - "target": 12, + "source": 11, + "target": 10, "value": 27 }, { - "source": 14, - "target": 13, + "source": 12, + "target": 11, "value": 27 }, { @@ -234,8 +234,8 @@ }, { "id": 16, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -301,8 +301,8 @@ }, { "id": 14, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -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": "", @@ -389,8 +389,8 @@ }, { "id": 11, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -408,31 +408,10 @@ "market_amount": 0, "balance": 0 }, - { - "id": 18, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, { "id": 13, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -450,10 +429,31 @@ "market_amount": 0, "balance": 0 }, + { + "id": 18, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, { "id": 20, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "account": "Assets:Coinbase:BTC", "commodity": "BTC", @@ -501,8 +501,8 @@ }, { "id": 16, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -568,8 +568,8 @@ }, { "id": 14, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -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": "", @@ -656,8 +656,8 @@ }, { "id": 11, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -675,31 +675,10 @@ "market_amount": 0, "balance": 0 }, - { - "id": 18, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, { "id": 13, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -717,10 +696,31 @@ "market_amount": 0, "balance": 0 }, + { + "id": 18, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, { "id": 20, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "account": "Assets:Coinbase:BTC", "commodity": "BTC", diff --git a/tests/fixture/inr-beancount/files.json b/tests/fixture/inr-beancount/files.json index 535607b..261168b 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-09 txn \"Buy Apple\"\n Assets:Equity:AAPL 100 AAPL {100 INR}\n Assets:Checking\n\n2022-01-10 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-11 txn \"Multi Currency Debit\"\n Expenses:Charges 100 INR\n Assets:Dollar 10 USD\n Assets:Checking\n\n2022-01-12 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/gain.json b/tests/fixture/inr-beancount/gain.json index 2433c2c..623d391 100644 --- a/tests/fixture/inr-beancount/gain.json +++ b/tests/fixture/inr-beancount/gain.json @@ -15,8 +15,8 @@ "postings": [ { "id": 20, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "account": "Assets:Coinbase:BTC", "commodity": "BTC", @@ -51,8 +51,8 @@ "postings": [ { "id": 18, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Dollar", "commodity": "USD", @@ -87,8 +87,8 @@ "postings": [ { "id": 11, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -108,8 +108,8 @@ }, { "id": 14, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -129,8 +129,8 @@ }, { "id": 13, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", diff --git a/tests/fixture/inr-beancount/income.json b/tests/fixture/inr-beancount/income.json index a887e5e..8938756 100644 --- a/tests/fixture/inr-beancount/income.json +++ b/tests/fixture/inr-beancount/income.json @@ -47,8 +47,8 @@ }, { "id": 14, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -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": "", @@ -144,8 +144,8 @@ }, { "id": 14, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -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/investment.json b/tests/fixture/inr-beancount/investment.json index 45e2075..e3576d6 100644 --- a/tests/fixture/inr-beancount/investment.json +++ b/tests/fixture/inr-beancount/investment.json @@ -44,8 +44,8 @@ }, { "id": 11, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -63,31 +63,10 @@ "market_amount": 0, "balance": 0 }, - { - "id": 18, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, { "id": 13, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -105,10 +84,31 @@ "market_amount": 0, "balance": 0 }, + { + "id": 18, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, { "id": 20, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "account": "Assets:Coinbase:BTC", "commodity": "BTC", @@ -176,8 +176,8 @@ }, { "id": 11, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -195,31 +195,10 @@ "market_amount": 0, "balance": 0 }, - { - "id": 18, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, { "id": 13, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -237,10 +216,31 @@ "market_amount": 0, "balance": 0 }, + { + "id": 18, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, { "id": 20, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "account": "Assets:Coinbase:BTC", "commodity": "BTC", diff --git a/tests/fixture/inr-beancount/ledger.json b/tests/fixture/inr-beancount/ledger.json index 48ac411..a4ee043 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", @@ -86,8 +86,8 @@ }, { "id": 21, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "account": "Assets:Checking", "commodity": "USD", @@ -107,8 +107,8 @@ }, { "id": 20, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "account": "Assets:Coinbase:BTC", "commodity": "BTC", @@ -126,31 +126,10 @@ "market_amount": 0, "balance": 1e-8 }, - { - "id": 15, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": 10027.3, - "amount": 10027, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 48, - "transaction_end_line": 52, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 10027, - "balance": 19817.5348 - }, { "id": 17, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Checking", "commodity": "INR", @@ -166,12 +145,33 @@ "note": "", "transaction_note": "", "market_amount": -100, - "balance": 9800.2348 + "balance": 19827.5348 + }, + { + "id": 18, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 804.42048, + "balance": 10 }, { "id": 16, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Expenses:Charges", "commodity": "INR", @@ -191,8 +191,8 @@ }, { "id": 19, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", "payee": "Multi Currency Debit", "account": "Assets:Checking", "commodity": "USD", @@ -208,33 +208,12 @@ "note": "", "transaction_note": "", "market_amount": -804.42048, - "balance": 9790.2348 - }, - { - "id": 14, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Income:CapitalGains:Equity:AAPL", - "commodity": "INR", - "quantity": -27.3, - "amount": -27, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 48, - "transaction_end_line": 52, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": -27, - "balance": -27.3 + "balance": 19817.5348 }, { "id": 13, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -253,30 +232,51 @@ "balance": 0 }, { - "id": 18, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, + "id": 14, + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Income:CapitalGains:Equity:AAPL", + "commodity": "INR", + "quantity": -27.3, + "amount": -27, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, + "transaction_begin_line": 48, + "transaction_end_line": 52, "file_name": "main.beancount", "forecast": false, "note": "", "transaction_note": "", - "market_amount": 804.42048, - "balance": 10 + "market_amount": -27, + "balance": -27.3 + }, + { + "id": 15, + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", + "payee": "Sell", + "account": "Assets:Checking", + "commodity": "INR", + "quantity": 10027.3, + "amount": 10027, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 48, + "transaction_end_line": 52, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 10027, + "balance": 19927.5348 }, { "id": 11, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", + "date": "2022-01-09T00:00:00Z", "payee": "Buy Apple", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -294,6 +294,27 @@ "market_amount": 10000, "balance": 100 }, + { + "id": 12, + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", + "date": "2022-01-09T00:00:00Z", + "payee": "Buy Apple", + "account": "Assets:Checking", + "commodity": "INR", + "quantity": -10000, + "amount": -10000, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 44, + "transaction_end_line": 47, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": -10000, + "balance": 9900.2348 + }, { "id": 10, "transaction_id": "c50a3b3ee30033764df6b4a179e09f8d", @@ -313,28 +334,7 @@ "note": "", "transaction_note": "", "market_amount": -8025.3170071296, - "balance": 9900.2348 - }, - { - "id": 12, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": -10000, - "amount": -10000, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 44, - "transaction_end_line": 47, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": -10000, - "balance": 10000 + "balance": 19900.2348 }, { "id": 9, diff --git a/tests/fixture/inr-beancount/main.beancount b/tests/fixture/inr-beancount/main.beancount index fd8b1cb..8fc8932 100644 --- a/tests/fixture/inr-beancount/main.beancount +++ b/tests/fixture/inr-beancount/main.beancount @@ -41,26 +41,29 @@ Assets:Equity:ABNB 0.76 ABNB {131.27 USD} Assets:Checking -2022-01-08 txn "Buy Apple" +2022-01-09 txn "Buy Apple" Assets:Equity:AAPL 100 AAPL {100 INR} Assets:Checking -2022-01-09 txn "Sell" +2022-01-10 txn "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-08 price USD 80.442048 INR -2022-01-09 txn "Multi Currency Debit" +2022-01-11 txn "Multi Currency Debit" Expenses:Charges 100 INR Assets:Dollar 10 USD Assets:Checking -2022-01-10 txn "Purchased 0.00000001 BTC" +2022-01-12 txn "Purchased 0.00000001 BTC" 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 5b3d768..ff61215 100644 --- a/tests/fixture/inr-beancount/networth.json +++ b/tests/fixture/inr-beancount/networth.json @@ -65,6 +65,15 @@ }, { "date": "2022-01-08T00:00:00Z", + "investmentAmount": 207963.762752, + "withdrawalAmount": 107963.762752, + "gainAmount": -61.5542551296, + "balanceAmount": 99938.4457448704, + "balanceUnits": 0, + "netInvestmentAmount": 100000 + }, + { + "date": "2022-01-09T00:00:00Z", "investmentAmount": 217963.762752, "withdrawalAmount": 117963.762752, "gainAmount": -61.5542551296, @@ -72,30 +81,21 @@ "balanceUnits": 0, "netInvestmentAmount": 100000 }, - { - "date": "2022-01-09T00:00:00Z", - "investmentAmount": 228795.183232, - "withdrawalAmount": 128895.183232, - "gainAmount": -34.5542551296, - "balanceAmount": 99865.4457448704, - "balanceUnits": 0, - "netInvestmentAmount": 99900 - }, { "date": "2022-01-10T00:00:00Z", - "investmentAmount": 228795.183232, - "withdrawalAmount": 128895.183232, - "gainAmount": -34.58866180237056, - "balanceAmount": 99865.41133819763, + "investmentAmount": 227990.762752, + "withdrawalAmount": 127990.762752, + "gainAmount": -34.5542551296, + "balanceAmount": 99965.4457448704, "balanceUnits": 0, - "netInvestmentAmount": 99900 + "netInvestmentAmount": 100000 }, { "date": "2022-01-11T00:00:00Z", "investmentAmount": 228795.183232, "withdrawalAmount": 128895.183232, - "gainAmount": -34.58866180237056, - "balanceAmount": 99865.41133819763, + "gainAmount": -34.5542551296, + "balanceAmount": 99865.4457448704, "balanceUnits": 0, "netInvestmentAmount": 99900 }, @@ -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 d1a5e9f..12adeb7 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", @@ -111,18 +111,18 @@ "note": "" }, { - "id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00:00:00Z", "payee": "Purchased 0.00000001 BTC", "postings": [ { - "id": 20, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "id": 21, + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00: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, - "transaction_id": "6bf2d0bd8cc5cc3ecfec78ecc069a14d", - "date": "2022-01-10T00:00:00Z", + "id": 20, + "transaction_id": "94f04e44ad603231840b705870e6467a", + "date": "2022-01-12T00: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": "", @@ -166,14 +166,111 @@ "note": "" }, { - "id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "postings": [ + { + "id": 18, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Dollar", + "commodity": "USD", + "quantity": 10, + "amount": 804.42048, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 16, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Expenses:Charges", + "commodity": "INR", + "quantity": 100, + "amount": 100, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 19, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -10, + "amount": -804.42048, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 17, + "transaction_id": "25cfdd99926f1f27ca89c0eaa4b96a3a", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Checking", + "commodity": "INR", + "quantity": -100, + "amount": -100, + "status": "cleared", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 55, + "transaction_end_line": 59, + "file_name": "main.beancount", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + } + ], + "tag_recurring": "", + "tag_period": "", + "beginLine": 55, + "endLine": 59, + "fileName": "main.beancount", + "note": "" + }, + { + "id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "postings": [ { "id": 15, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Checking", "commodity": "INR", @@ -193,8 +290,8 @@ }, { "id": 14, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Income:CapitalGains:Equity:AAPL", "commodity": "INR", @@ -214,8 +311,8 @@ }, { "id": 13, - "transaction_id": "cd3f8d42555f448182a3cf8d5fbc59d5", - "date": "2022-01-09T00:00:00Z", + "transaction_id": "3b252f03f4e42a4cd3861e6b3dc6b8f1", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Equity:AAPL", "commodity": "AAPL", @@ -242,45 +339,24 @@ "note": "" }, { - "id": "4bb9978f0b460e697351755e71548110", + "id": "bb27c9f651527e62d2528e13b9fb7c8b", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", + "payee": "Buy Apple", "postings": [ { - "id": 18, - "transaction_id": "4bb9978f0b460e697351755e71548110", + "id": 11, + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Dollar", - "commodity": "USD", - "quantity": 10, - "amount": 804.42048, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 16, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Expenses:Charges", - "commodity": "INR", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", "quantity": 100, - "amount": 100, + "amount": 10000, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, + "transaction_begin_line": 44, + "transaction_end_line": 47, "file_name": "main.beancount", "forecast": false, "note": "", @@ -289,40 +365,19 @@ "balance": 0 }, { - "id": 19, - "transaction_id": "4bb9978f0b460e697351755e71548110", + "id": 12, + "transaction_id": "bb27c9f651527e62d2528e13b9fb7c8b", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -10, - "amount": -804.42048, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 17, - "transaction_id": "4bb9978f0b460e697351755e71548110", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", + "payee": "Buy Apple", "account": "Assets:Checking", "commodity": "INR", - "quantity": -100, - "amount": -100, + "quantity": -10000, + "amount": -10000, "status": "cleared", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 55, - "transaction_end_line": 59, + "transaction_begin_line": 44, + "transaction_end_line": 47, "file_name": "main.beancount", "forecast": false, "note": "", @@ -333,8 +388,8 @@ ], "tag_recurring": "", "tag_period": "", - "beginLine": 55, - "endLine": 59, + "beginLine": 44, + "endLine": 47, "fileName": "main.beancount", "note": "" }, @@ -393,61 +448,6 @@ "fileName": "main.beancount", "note": "" }, - { - "id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "postings": [ - { - "id": 11, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": 100, - "amount": 10000, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 44, - "transaction_end_line": 47, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 12, - "transaction_id": "6dbec46bcfb775a8e4fad777b9050a4c", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": -10000, - "amount": -10000, - "status": "cleared", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 44, - "transaction_end_line": 47, - "file_name": "main.beancount", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - } - ], - "tag_recurring": "", - "tag_period": "", - "beginLine": 44, - "endLine": 47, - "fileName": "main.beancount", - "note": "" - }, { "id": "d14e425ba0d573ba0388d100bda5eb80", "date": "2022-01-07T00:00:00Z", diff --git a/tests/fixture/inr-hledger/expense.json b/tests/fixture/inr-hledger/expense.json index 5115d8a..d3c8b85 100644 --- a/tests/fixture/inr-hledger/expense.json +++ b/tests/fixture/inr-hledger/expense.json @@ -395,27 +395,6 @@ "market_amount": 0, "balance": 0 }, - { - "id": 12, - "transaction_id": "6", - "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", - "quantity": 100, - "amount": 10000, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, { "id": 15, "transaction_id": "9", @@ -437,6 +416,27 @@ "market_amount": 0, "balance": 0 }, + { + "id": 12, + "transaction_id": "6", + "date": "2022-01-08T00:00:00Z", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", + "quantity": 100, + "amount": 10000, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 26, + "transaction_end_line": 29, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, { "id": 23, "transaction_id": "11", @@ -704,27 +704,6 @@ "market_amount": 0, "balance": 0 }, - { - "id": 12, - "transaction_id": "6", - "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", - "quantity": 100, - "amount": 10000, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, { "id": 15, "transaction_id": "9", @@ -746,6 +725,27 @@ "market_amount": 0, "balance": 0 }, + { + "id": 12, + "transaction_id": "6", + "date": "2022-01-08T00:00:00Z", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", + "quantity": 100, + "amount": 10000, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 26, + "transaction_end_line": 29, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, { "id": 23, "transaction_id": "11", diff --git a/tests/fixture/inr-hledger/investment.json b/tests/fixture/inr-hledger/investment.json index 9b00c62..cb8c6bb 100644 --- a/tests/fixture/inr-hledger/investment.json +++ b/tests/fixture/inr-hledger/investment.json @@ -63,27 +63,6 @@ "market_amount": 0, "balance": 0 }, - { - "id": 12, - "transaction_id": "6", - "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", - "quantity": 100, - "amount": 10000, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, { "id": 15, "transaction_id": "9", @@ -105,6 +84,27 @@ "market_amount": 0, "balance": 0 }, + { + "id": 12, + "transaction_id": "6", + "date": "2022-01-08T00:00:00Z", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", + "quantity": 100, + "amount": 10000, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 26, + "transaction_end_line": 29, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, { "id": 23, "transaction_id": "11", @@ -237,27 +237,6 @@ "market_amount": 0, "balance": 0 }, - { - "id": 12, - "transaction_id": "6", - "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", - "quantity": 100, - "amount": 10000, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, { "id": 15, "transaction_id": "9", @@ -279,6 +258,27 @@ "market_amount": 0, "balance": 0 }, + { + "id": 12, + "transaction_id": "6", + "date": "2022-01-08T00:00:00Z", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", + "quantity": 100, + "amount": 10000, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 26, + "transaction_end_line": 29, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, { "id": 23, "transaction_id": "11", diff --git a/tests/fixture/inr-hledger/ledger.json b/tests/fixture/inr-hledger/ledger.json index ef8fdfc..bbe30e2 100644 --- a/tests/fixture/inr-hledger/ledger.json +++ b/tests/fixture/inr-hledger/ledger.json @@ -273,27 +273,6 @@ "market_amount": -10000, "balance": 40000 }, - { - "id": 12, - "transaction_id": "6", - "date": "2022-01-08T00:00:00Z", - "payee": "Investment 3", - "account": "Assets:Equity:NIFTY", - "commodity": "NIFTY", - "quantity": 100, - "amount": 10000, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 29, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 10027.3, - "balance": 800 - }, { "id": 15, "transaction_id": "9", @@ -315,6 +294,27 @@ "market_amount": 10000, "balance": 100 }, + { + "id": 12, + "transaction_id": "6", + "date": "2022-01-08T00:00:00Z", + "payee": "Investment 3", + "account": "Assets:Equity:NIFTY", + "commodity": "NIFTY", + "quantity": 100, + "amount": 10000, + "status": "unmarked", + "tag_recurring": "", + "tag_period": "", + "transaction_begin_line": 26, + "transaction_end_line": 29, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 10027.3, + "balance": 800 + }, { "id": 14, "transaction_id": "7", diff --git a/tests/fixture/inr/allocation.json b/tests/fixture/inr/allocation.json index c33f54a..bbb3b08 100644 --- a/tests/fixture/inr/allocation.json +++ b/tests/fixture/inr/allocation.json @@ -95,40 +95,30 @@ "Assets:Checking": { "date": "2022-01-08T00:00:00Z", "account": "Assets:Checking", + "market_amount": 11974.6829928704 + }, + "Assets:Equity:ABNB": { + "date": "2022-01-08T00:00:00Z", + "account": "Assets:Equity:ABNB", + "market_amount": 8025.3170071296 + }, + "Assets:Equity:NIFTY": { + "date": "2022-01-08T00:00:00Z", + "account": "Assets:Equity:NIFTY", + "market_amount": 80000 + } + }, + { + "Assets:Checking": { + "date": "2022-01-09T00:00:00Z", + "account": "Assets:Checking", "market_amount": 1974.6829928704 }, "Assets:Equity:AAPL": { - "date": "2022-01-08T00:00:00Z", + "date": "2022-01-09T00:00:00Z", "account": "Assets:Equity:AAPL", "market_amount": 10000 }, - "Assets:Equity:ABNB": { - "date": "2022-01-08T00:00:00Z", - "account": "Assets:Equity:ABNB", - "market_amount": 8025.3170071296 - }, - "Assets:Equity:NIFTY": { - "date": "2022-01-08T00:00:00Z", - "account": "Assets:Equity:NIFTY", - "market_amount": 80000 - } - }, - { - "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 - }, - "Assets:Equity:AAPL": { - "date": "2022-01-09T00:00:00Z", - "account": "Assets:Equity:AAPL", - "market_amount": 0 - }, "Assets:Equity:ABNB": { "date": "2022-01-09T00:00:00Z", "account": "Assets:Equity:ABNB", @@ -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 4f12ef8..ac1ce45 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 f63b5a1..ecd0cf9 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,15 +145,112 @@ "fileName": "main.ledger", "note": " Global note\n :interest:" }, + { + "id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "postings": [ + { + "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": 35, + "transaction_end_line": 38, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 16, + "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Expenses:Charges", + "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": 0, + "balance": 0 + }, + { + "id": 19, + "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -10, + "amount": -804.42048, + "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": 0, + "balance": 0 + }, + { + "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": -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": 0, + "balance": 0 + } + ], + "tag_recurring": "", + "tag_period": "", + "beginLine": 35, + "endLine": 38, + "fileName": "main.ledger", + "note": "" + }, { "id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "postings": [ { "id": 15, "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Checking", "commodity": "INR", @@ -174,7 +271,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", @@ -195,7 +292,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", @@ -222,45 +319,24 @@ "note": "" }, { - "id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "id": "608fccf0-e80c-570e-87df-63a9a959c59a", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", + "payee": "Buy Apple", "postings": [ { - "id": 17, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "id": 11, + "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", "date": "2022-01-09T00: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": 35, - "transaction_end_line": 38, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 16, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Expenses:Charges", - "commodity": "INR", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", "quantity": 100, - "amount": 100, + "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 35, - "transaction_end_line": 38, + "transaction_begin_line": 26, + "transaction_end_line": 28, "file_name": "main.ledger", "forecast": false, "note": "", @@ -269,40 +345,19 @@ "balance": 0 }, { - "id": 19, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "id": 12, + "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -10, - "amount": -804.42048, - "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": 0, - "balance": 0 - }, - { - "id": 18, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", + "payee": "Buy Apple", "account": "Assets:Checking", "commodity": "INR", - "quantity": -100, - "amount": -100, + "quantity": -10000, + "amount": -10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 35, - "transaction_end_line": 38, + "transaction_begin_line": 26, + "transaction_end_line": 28, "file_name": "main.ledger", "forecast": false, "note": "", @@ -313,8 +368,8 @@ ], "tag_recurring": "", "tag_period": "", - "beginLine": 35, - "endLine": 38, + "beginLine": 26, + "endLine": 28, "fileName": "main.ledger", "note": "" }, @@ -373,61 +428,6 @@ "fileName": "main.ledger", "note": "" }, - { - "id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "postings": [ - { - "id": 11, - "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00: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": 0, - "balance": 0 - }, - { - "id": 12, - "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": -10000, - "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": 0, - "balance": 0 - } - ], - "tag_recurring": "", - "tag_period": "", - "beginLine": 26, - "endLine": 28, - "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 2eadf00..63a52df 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", @@ -395,31 +395,10 @@ "market_amount": 0, "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, - "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": 0, - "balance": 0 - }, { "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", @@ -436,6 +415,27 @@ "transaction_note": "", "market_amount": 0, "balance": 0 + }, + { + "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": 35, + "transaction_end_line": 38, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 } ] }, @@ -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", @@ -641,31 +641,10 @@ "market_amount": 0, "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, - "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": 0, - "balance": 0 - }, { "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", @@ -682,6 +661,27 @@ "transaction_note": "", "market_amount": 0, "balance": 0 + }, + { + "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": 35, + "transaction_end_line": 38, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 } ] }, diff --git a/tests/fixture/inr/files.json b/tests/fixture/inr/files.json index 352f167..6c92fbd 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 5837e54..e0700a4 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 5c78de3..77458d2 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 9a492ac..ceefa24 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", @@ -63,31 +63,10 @@ "market_amount": 0, "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, - "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": 0, - "balance": 0 - }, { "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", @@ -104,6 +83,27 @@ "transaction_note": "", "market_amount": 0, "balance": 0 + }, + { + "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": 35, + "transaction_end_line": 38, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 } ], "yearly_cards": [ @@ -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", @@ -174,31 +174,10 @@ "market_amount": 0, "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, - "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": 0, - "balance": 0 - }, { "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", @@ -215,6 +194,27 @@ "transaction_note": "", "market_amount": 0, "balance": 0 + }, + { + "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": 35, + "transaction_end_line": 38, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 } ], "gross_salary_income": 120000, diff --git a/tests/fixture/inr/ledger.json b/tests/fixture/inr/ledger.json index 0d64385..9a8c1b7 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,12 +103,75 @@ "note": "", "transaction_note": "", "market_amount": -804.42048, - "balance": 9790.2348 + "balance": 19817.5348 + }, + { + "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": -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": 19827.5348 + }, + { + "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": "", + "transaction_note": "", + "market_amount": -10027.3, + "balance": 0 + }, + { + "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": 30, + "transaction_end_line": 33, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 10027.3, + "balance": 19927.5348 }, { "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", @@ -169,25 +190,46 @@ "balance": -27.3 }, { - "id": 13, - "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", + "id": 12, + "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", "date": "2022-01-09T00:00:00Z", - "payee": "Sell", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": -100, + "payee": "Buy Apple", + "account": "Assets:Checking", + "commodity": "INR", + "quantity": -10000, "amount": -10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 30, - "transaction_end_line": 33, + "transaction_begin_line": 26, + "transaction_end_line": 28, "file_name": "main.ledger", "forecast": false, "note": "", "transaction_note": "", - "market_amount": -10027.3, - "balance": 0 + "market_amount": -10000, + "balance": 9900.2348 + }, + { + "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, @@ -210,27 +252,6 @@ "market_amount": -8025.3170071296, "balance": 19900.2348 }, - { - "id": 12, - "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": -10000, - "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": -10000, - "balance": 9900.2348 - }, { "id": 9, "transaction_id": "c4ee69cc-e6bc-56a4-b573-e5519afb2a45", @@ -253,25 +274,25 @@ "balance": 0.76 }, { - "id": 11, - "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Equity:AAPL", - "commodity": "AAPL", - "quantity": 100, - "amount": 10000, + "id": 8, + "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, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 26, - "transaction_end_line": 28, + "transaction_begin_line": 18, + "transaction_end_line": 20, "file_name": "main.ledger", "forecast": false, "note": "", "transaction_note": "", - "market_amount": 10027.3, - "balance": 100 + "market_amount": 80218.4, + "balance": 800 }, { "id": 7, @@ -294,27 +315,6 @@ "market_amount": -80000, "balance": 20000 }, - { - "id": 8, - "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, - "status": "unmarked", - "tag_recurring": "", - "tag_period": "", - "transaction_begin_line": 18, - "transaction_end_line": 20, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 80218.4, - "balance": 800 - }, { "id": 6, "transaction_id": "9ac83c1f-ba46-515b-8e19-3ca8ab332eab", diff --git a/tests/fixture/inr/main.ledger b/tests/fixture/inr/main.ledger index 2444596..f10f534 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 0eb6936..ece472d 100644 --- a/tests/fixture/inr/networth.json +++ b/tests/fixture/inr/networth.json @@ -65,6 +65,15 @@ }, { "date": "2022-01-08T00:00:00Z", + "investmentAmount": 208025.3170071296, + "withdrawalAmount": 108025.3170071296, + "gainAmount": 0, + "balanceAmount": 100000, + "balanceUnits": 0, + "netInvestmentAmount": 100000 + }, + { + "date": "2022-01-09T00:00:00Z", "investmentAmount": 218025.3170071296, "withdrawalAmount": 118025.3170071296, "gainAmount": 0, @@ -72,23 +81,14 @@ "balanceUnits": 0, "netInvestmentAmount": 100000 }, - { - "date": "2022-01-09T00:00:00Z", - "investmentAmount": 228857.0374871296, - "withdrawalAmount": 128957.0374871296, - "gainAmount": 27.3, - "balanceAmount": 99927.3, - "balanceUnits": 0, - "netInvestmentAmount": 99900 - }, { "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 39b4b31..caafc8c 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 bc00fb1..3e29bcf 100644 --- a/tests/fixture/inr/transaction.json +++ b/tests/fixture/inr/transaction.json @@ -55,15 +55,112 @@ "fileName": "main.ledger", "note": " Global note\n :interest:" }, + { + "id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "postings": [ + { + "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": 35, + "transaction_end_line": 38, + "file_name": "main.ledger", + "forecast": false, + "note": "", + "transaction_note": "", + "market_amount": 0, + "balance": 0 + }, + { + "id": 16, + "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Expenses:Charges", + "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": 0, + "balance": 0 + }, + { + "id": 19, + "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "date": "2022-01-11T00:00:00Z", + "payee": "Multi Currency Debit", + "account": "Assets:Checking", + "commodity": "USD", + "quantity": -10, + "amount": -804.42048, + "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": 0, + "balance": 0 + }, + { + "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": -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": 0, + "balance": 0 + } + ], + "tag_recurring": "", + "tag_period": "", + "beginLine": 35, + "endLine": 38, + "fileName": "main.ledger", + "note": "" + }, { "id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "postings": [ { "id": 15, "transaction_id": "b2e50492-9dc7-5845-8ed9-9f4590b301a8", - "date": "2022-01-09T00:00:00Z", + "date": "2022-01-10T00:00:00Z", "payee": "Sell", "account": "Assets:Checking", "commodity": "INR", @@ -84,7 +181,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", @@ -105,7 +202,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", @@ -132,45 +229,24 @@ "note": "" }, { - "id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "id": "608fccf0-e80c-570e-87df-63a9a959c59a", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", + "payee": "Buy Apple", "postings": [ { - "id": 17, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "id": 11, + "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", "date": "2022-01-09T00: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": 35, - "transaction_end_line": 38, - "file_name": "main.ledger", - "forecast": false, - "note": "", - "transaction_note": "", - "market_amount": 0, - "balance": 0 - }, - { - "id": 16, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Expenses:Charges", - "commodity": "INR", + "payee": "Buy Apple", + "account": "Assets:Equity:AAPL", + "commodity": "AAPL", "quantity": 100, - "amount": 100, + "amount": 10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 35, - "transaction_end_line": 38, + "transaction_begin_line": 26, + "transaction_end_line": 28, "file_name": "main.ledger", "forecast": false, "note": "", @@ -179,40 +255,19 @@ "balance": 0 }, { - "id": 19, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", + "id": 12, + "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", - "account": "Assets:Checking", - "commodity": "USD", - "quantity": -10, - "amount": -804.42048, - "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": 0, - "balance": 0 - }, - { - "id": 18, - "transaction_id": "13751d3a-ebfe-5de8-aca5-8870bc86ff9d", - "date": "2022-01-09T00:00:00Z", - "payee": "Multi Currency Debit", + "payee": "Buy Apple", "account": "Assets:Checking", "commodity": "INR", - "quantity": -100, - "amount": -100, + "quantity": -10000, + "amount": -10000, "status": "unmarked", "tag_recurring": "", "tag_period": "", - "transaction_begin_line": 35, - "transaction_end_line": 38, + "transaction_begin_line": 26, + "transaction_end_line": 28, "file_name": "main.ledger", "forecast": false, "note": "", @@ -223,8 +278,8 @@ ], "tag_recurring": "", "tag_period": "", - "beginLine": 35, - "endLine": 38, + "beginLine": 26, + "endLine": 28, "fileName": "main.ledger", "note": "" }, @@ -283,61 +338,6 @@ "fileName": "main.ledger", "note": "" }, - { - "id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "postings": [ - { - "id": 11, - "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00: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": 0, - "balance": 0 - }, - { - "id": 12, - "transaction_id": "608fccf0-e80c-570e-87df-63a9a959c59a", - "date": "2022-01-08T00:00:00Z", - "payee": "Buy Apple", - "account": "Assets:Checking", - "commodity": "INR", - "quantity": -10000, - "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": 0, - "balance": 0 - } - ], - "tag_recurring": "", - "tag_period": "", - "beginLine": 26, - "endLine": 28, - "fileName": "main.ledger", - "note": "" - }, { "id": "928a326f-93b5-5967-96e8-fe18ad9bf45f", "date": "2022-01-07T00:00:00Z",