Coder Social home page Coder Social logo

KeyError: 'BTS_BTC' about pgportfolio HOT 7 OPEN

dalle244 avatar dalle244 commented on July 17, 2024 3
KeyError: 'BTS_BTC'

from pgportfolio.

Comments (7)

tiassap avatar tiassap commented on July 17, 2024

Hello,
I am also facing this error. Seems like the error comes out when using class CoinList(), there is a mismatch between dict key from self._polo.marketVolume() and self._polo.marketTicker()

  File "/home/tias/Data_science/1_project/zhengyaojiang_pgportfolio_dev/pgportfolio/marketdata/coinlist.py", line 36, in __init__
    prices.append(1.0 / float(ticker[k]['last']))
KeyError: 'BTS_BTC'

prices.append(1.0 / float(ticker[k]['last']))

from pgportfolio.

dekrypting-karma avatar dekrypting-karma commented on July 17, 2024

@tiassap did you solve the error?

from pgportfolio.

tiassap avatar tiassap commented on July 17, 2024

@dekrypting-karma

I could avoid KeyError: 'BTS_BTC' by replacing the for-loop inside CoinList.__init__() (inside coinlist.py) with this

for k in ticker.keys():
            if k.startswith("BTC_") or k.endswith("_BTC"):
                pairs.append(k)
                for c in k.split("_"):
                    if c != 'BTC':
                        if k.endswith('_BTC'):
                            coins.append('reversed_' + c)
                            prices.append(1.0 / float(ticker[k]['last']))
                        else:
                            coins.append(c)
                            prices.append(float(ticker[k]['last']))
                    else:
                        volumes.append(self.__get_total_volume(pair=k, global_end=end,
                                                               days=volume_average_days,
                                                               forward=volume_forward))

But there are still many errors will come out related to sql command line parsing and also error because in HistoryManager.get_global_panel() pandas Panel is used (deprecated since pandas version 0.20.0)

from pgportfolio.

dekrypting-karma avatar dekrypting-karma commented on July 17, 2024

@tiassap this helped in removing KeyError: 'BTS_BTC'. But I am also facing multiple errors in HistoryManager.get_global_panel().

Were you able to successfully run this project? If yes can you please share the code?
Any sort of help is appreciated.

from pgportfolio.

chenjjcccc avatar chenjjcccc commented on July 17, 2024

@dekrypting-karma

I could avoid KeyError: 'BTS_BTC' by replacing the for-loop inside CoinList.__init__() (inside coinlist.py) with this

for k in ticker.keys():
            if k.startswith("BTC_") or k.endswith("_BTC"):
                pairs.append(k)
                for c in k.split("_"):
                    if c != 'BTC':
                        if k.endswith('_BTC'):
                            coins.append('reversed_' + c)
                            prices.append(1.0 / float(ticker[k]['last']))
                        else:
                            coins.append(c)
                            prices.append(float(ticker[k]['last']))
                    else:
                        volumes.append(self.__get_total_volume(pair=k, global_end=end,
                                                               days=volume_average_days,
                                                               forward=volume_forward))

But there are still many errors will come out related to sql command line parsing and also error because in HistoryManager.get_global_panel() pandas Panel is used (deprecated since pandas version 0.20.0)

did you solve the error?

from pgportfolio.

lucacarniato avatar lucacarniato commented on July 17, 2024

you could use xarray.DataArray

https://docs.xarray.dev/en/stable/generated/xarray.DataArray.html

from pgportfolio.

tiassap avatar tiassap commented on July 17, 2024

@dekrypting-karma , @lucacarniato

Sorry I was unable to response for a long time.
I created Docker container to make environment so we can use old pandas version and old tensorflow module here: https://github.com/tiassap/PGPortfolio

Seems like there is still problem with Binance API.. Please try it and help me make the code works again.

from pgportfolio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.