6

Does anyone have recommendations when it comes to monitoring BTC trading profit and loss? I find it confusing when taking into account the transaction fee the exchanges impose (ie- GDAX). I use Coinigy for charts and entering orders.

2

No need for fancy scripts and databases:

[what you put in] - [what you got out] = [your profit]

All you need to know:

  • the price of BTC at the beginning of the period
  • the price of BTC at the end of the period
  • have a list of all USD deposits/withdrawals
  • have a list of all BTC deposits/withdrawals (and the value of BTC in USD at that moment the deposit or withdrawal was made)

I will try to explain with an example:

  1. Starting balance = $0 + 1 BTC
  2. Deposit $1,000 (balance = $1,000 + 1 BTC)
  3. Buy 1 BTC @ $900/BTC 1% fee = 0.01 BTC (balance = $100 + 1.99 BTC)
  4. Sell 0.5 BTC @ $920/BTC 1% fee = $46 (balance = $555.40 + 1.49 BTC)
  5. Withdraw $500 (balance = $55.40 + 1.49 BTC)

For a certain period in time the profit

= ([value of all assets at end of period] – [value of all assets at beginning of period]) + ([value of assets withdrawn] – [value of assets deposited])
= (($55.40 + 1.49BTC) - ($0 + 1BTC)) + (($500 + 0BTC) - ($1,000 + 0BTC))
= (($55.40 + 1.49BTC x $920) - ($0 + 1BTC x $900)) + (($500 + $0 x $920) - ($1,000 + $0 x $900)) // convert BTC to USD for the price at that time
= (($55.40 + $1,370.80) - ($0 + $900)) + (($500 + $0) - ($1,000 + $0))
= ($1,426.20 - $900) - $500 // My assets is worth $1426.20 at the end of the period, it was worth $900 at the beginning of the period but I added $500 from external sources (deposit - withdraw)
= $26.20 // Total value of my assets increased by $26.20

Even if I made zero trades for the month and the BTC price increased while I had BTC "stock", I would have made "profit" from a USD perspective as my total assets' value increased in USD terms.

1

If you're concerned with privacy, checkout my app Coinfox, cryptocoin portfolio tracker. It stores all your data client side in localStorage, and is fully open source

1

This spreadsheet does the calculations for you, you just need to input your buys and sells: https://github.com/alanhett/coin-cost-basis

0

You could use a script that gets executed every day that connects to your exchange using their API and requests your balances.

If you were calculating your profit and loss using USD as your base currency you could take the current market price for BTC/USD and multiply that by the total number of BTC you have on balance, then add that to your USD balance to get your total USD balance. Then store your total USD balance for that day in a database.

Now your database should have records of your daily USD balance, from which you can calculate your daily P&L. You could obviously use another script to generate a PDF or webpage showing your P&L graphically.

If you're looking to track per trade P&L, that's just a matter of utilizing the API to get a list of your trades and then calculate the P&Ls individually based on first in first out accounting.

I hope I was able to give you some ideas.

0

I made a site to use the Coinbase API to keep track of your net gains/losses. Check it out at profbit.info

protected by Community Jan 2 '18 at 19:59

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.