Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coin/coin trades #62

Closed
6 of 8 tasks
robertkarl opened this issue Aug 20, 2019 · 0 comments · Fixed by #89
Closed
6 of 8 tasks

Coin/coin trades #62

robertkarl opened this issue Aug 20, 2019 · 0 comments · Fixed by #89

Comments

@robertkarl
Copy link
Owner

robertkarl commented Aug 20, 2019

Support markets like ETH/BTC.

These are required for importing trade data from Binance for example.

  • Right now, we have asset_name as a field on Transaction.

Migration plan

  • add new fields to in-memory object (quantity_traded, quantity_received, symbol_traded, symbol_received)
  • Allow passing the new fields to constructor of Transaction
  • Deprecate usd_subtotal and quantity fields
  • Add migrate script to add the fields to existing DBs
  • write the values for 4 new fields to in-memory objects. (Still create Transactions using old syntax, but propagate it to new columns). This ability is critical for migration.
  • Move basis calculation logic to use NEW fields. Stop using usd_subtotal in basis.py. This is the most critical step for making sure basis calculations are still correct.

At this point we should be able to use both syntaxes. Either usd_subtotal and asset_name, or the fully specified one.

  • Migrate ALL usages of Transaction over to new syntax
  • Remove the deprecated parameters from Transaction constructor
robertkarl added a commit that referenced this issue Oct 25, 2019
closes #62 !

# Test plan
```
$ PYTHONPATH=src python -m yabc testdata/binance/binance.csv 
3 transactions to be reported

<CostBasisReport: Sold 1 BTC on 2017-01-01 11:22:00 for $1075. Exchange: binance. Profit:$1075.
	<TX 2017-01-01 11:22:00 SELL 125.0 ETH for 1 BTC, from exchange binance. Fee 0.01 ETH>>
<CostBasisReport: Sold 125.0 ETH on 2017-01-01 11:23:00 for $1009. Exchange: binance. Profit:$0.
	<TX 2017-01-01 11:23:00 SELL 1 BTC for 125 ETH, from exchange binance. Fee 0.01 ETH>>
<CostBasisReport: Sold 1 BTC on 2017-01-01 11:24:00 for $10030. Exchange: binance. Profit:$8955.
	<TX 2017-01-01 11:24:00 SELL 10030 USD for 1 BTC, from exchange binance. Fee 0.01 BTC>>

total gain or loss for above transactions: 10030

total basis for above transactions: 2084
total proceeds for above transactions: 12114
Remaining coins after sales:
<TX 2017-01-01 11:24:00 BUY 1 BTC for 10025 USD, from exchange binance. Fee 0.01 BTC>

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant