BenjiLee / PoloniexAnalyzer

Trade history and balance analyzer for Poloniex
MIT License
78 stars 22 forks source link

GetOverview #28

Closed criptonauta closed 7 years ago

criptonauta commented 7 years ago

Hi Benji!

When I use GetOverview with an API that have on its account a delisted currency in trade history, I get the following error.

EBT=84420.685385-0=84420.685385
DASH=0.05-0=0.05
XCP=85.55534115-0=85.55534115
REP=244.11774949-0=244.11774949
BTC=0.15798327-0.34312576=-0.18514249
Traceback (most recent call last):
  File "poloniex.py", line 65, in <module>
    main()
  File "poloniex.py", line 57, in main
    actions[args.action]['function']()
  File "D:\POLO\ash\analyzer.py", line 29, in get_overview
    balance = dw_history.get_btc_balance(public_api.return_ticker())
  File "D:\POLO\ash\poloniex_apis\api_models\deposit_withdrawal_history.py", line 28, in get_btc_balance
    balance += amount * float(ticker_data[u'BTC_' + deposit]['last'])
KeyError: u'BTC_EBT'

Is it possible to deselect coins or just remove one in particular?

BR

BenjiLee commented 7 years ago

Thanks for your report! I haven't come across a delisted coin yet. I think we would have to know how the delist coin would affect the account.

I'm currently thinking...

Zettt commented 7 years ago

That's hard to tell. As far I'm thinking, the last value the delisted coin had at the point it was delisted is the value it will be taken to the account balance. That said, I also don't think it's possible to use these coins for any trading. Therefore the only thing that you can do with them, is to withdraw and send to a foreign wallet.

Does it even make sense to include delisted coins in the account balance, I wonder? What do you guys think?

BenjiLee commented 7 years ago

Does it even make sense to include delisted coins in the account balance, I wonder? What do you guys think?

Sounds like we can count the delisted coin as a null value.

I ran into the same issue with GetDetailedOverview and the solution was just to return no value to the coin.

BenjiLee commented 7 years ago

Proposed fix here https://github.com/BenjiLee/PoloniexAnalyzer/pull/37

criptonauta commented 7 years ago

In v1.0.0.0:

-----Deposit/Withdrawal History-----

--Currency=Deposit-Withdrawal=Total- EBT=84420.685385-0=84420.685385 DASH=0.05-0=0.05 XCP=85.55534115-0=85.55534115 REP=244.11774949-0=244.11774949 BTC=0.61546581-0.89108816=-0.27562235 Traceback (most recent call last): File "poloniex.py", line 64, in main() File "poloniex.py", line 56, in main actions[args.action]['function']() File "/root/polo/analyzer.py", line 28, in get_overview balance = dw_history.get_btc_balance(public_api.return_ticker()) File "/root/polo/poloniex_apis/api_models/deposit_withdrawal_history.py", line 27, in get_btc_balance balance += amount * float(tickerdata[u'BTC' + deposit]['last']) KeyError: u'BTC_EBT' root@vmi115478:~/polo ?

I'll try the p3 version and will reply after the test.

Thanks!

criptonauta commented 7 years ago

Results of Py3 version:

root@vmi115478:~/ana3 ? python3 poloniex.py -a GetOverview -----Deposit/Withdrawal History-----

--Currency=Deposit-Withdrawal=Total- XCP=85.55534115-0=85.55534115 BTC=0.61546581-0.8910881599999998=-0.2756223499999998 REP=244.11774949-0=244.11774949 EBT=84420.685385-0=84420.685385 DASH=0.05-0=0.05 Traceback (most recent call last): File "poloniex.py", line 73, in main() File "poloniex.py", line 65, in main actions[args.action]['function']() File "/root/ana3/analyzer.py", line 28, in get_overview balance = dw_history.get_btc_balance(public_api.return_ticker()) File "/root/ana3/poloniex_apis/api_models/deposit_withdrawal_history.py", line 27, in get_btc_balance balance += amount * float(tickerdata[u'BTC' + deposit]['last']) KeyError: 'BTC_EBT'

BenjiLee commented 7 years ago

@criptonauta You need to checkout the branch called delisted. Please leave comments on https://github.com/BenjiLee/PoloniexAnalyzer/pull/37

BenjiLee commented 7 years ago

https://github.com/BenjiLee/PoloniexAnalyzer/pull/37 has been merged.

criptonauta commented 7 years ago

Hi guys

I still don't know how you solved the problem.

I'm trying in another account that had (now delisted) BBR and the error persists:

Deposit/Withdrawal History

Currency=Deposit-Withdrawal=Total- BTC=0.007861-0=0.007861 Traceback (most recent call last): File "poloniex.py", line 73, in main() File "poloniex.py", line 65, in main actions[args.action]['function']() File "/home/ubuntu/.anapolo/analyzer.py", line 29, in get_overview current = balances.get_btc_total() File "/home/ubuntu/.anapolo/poloniex_apis/api_models/balances.py", line 10, in get_btc_total for stock, balances in self.get_active_balances().items(): AttributeError: 'Balances' object has no attribute 'get_active_balances' `

BenjiLee commented 7 years ago

@criptonauta that was a new bug I introduced recently >.<

I fixed it https://github.com/BenjiLee/PoloniexAnalyzer/commit/e986951ef40e813d6c236fed679c19f8a26ef723

This is probably a good time to add unit tests :/

criptonauta commented 7 years ago

Hi Guys! I wish it had that much profit, but not yet ^^

image