Giter Club home page Giter Club logo

stockbot's People

Contributors

shirosaidev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stockbot's Issues

get_barset is deprecated

get_barset was deprecated in favor of get_bars. We also need to use TimeFrame.Day. There are likely many other issues related to this, but I'm still working through them.

                 for d in data['data']['table']['rows']:
                     # Get daily price data for stock symbol over the last n trading days.
-                    barset = api.get_barset(d['symbol'], 'day', limit=MOVED_DAYS)
+                    barset = api.get_bars(d['symbol'], TimeFrame.Day, limit=MOVED_DAYS)
                     if not barset[d['symbol']]:
                         print('stock symbol {} not found'.format(d['symbol']))
                         continue

Hours are read from config as strings but compared as ints

Suggested fix:

     # times to buy/sell

     if startbuytime == 'buyatopen':
-        get_stocks_h, get_stocks_m = BAO_GET_STOCKS_TIME.split(':')
-        buy_sh, buy_sm = BAO_BUY_START_TIME.split(':')
-        buy_eh, buy_em = BAO_BUY_END_TIME.split(':')
-        sell_sh, sell_sm = BAO_SELL_START_TIME.split(':')
-        sell_eh, sell_em = BAO_SELL_END_TIME.split(':')
+        get_stocks_h, get_stocks_m = list(map(int, BAO_GET_STOCKS_TIME.split(':')))
+        buy_sh, buy_sm = list(map(int, BAO_BUY_START_TIME.split(':')))
+        buy_eh, buy_em = list(map(int, BAO_BUY_END_TIME.split(':')))
+        sell_sh, sell_sm = list(map(int, BAO_SELL_START_TIME.split(':')))
+        sell_eh, sell_em = list(map(int, BAO_SELL_END_TIME.split(':')))
     else:  # buy at close
-        get_stocks_h, get_stocks_m = BAC_GET_STOCKS_TIME.split(':')
-        buy_sh, buy_sm = BAC_BUY_START_TIME.split(':')
-        buy_eh, buy_em = BAC_BUY_END_TIME.split(':')
-        sell_sh, sell_sm = BAC_SELL_START_TIME.split(':')
-        sell_eh, sell_em = BAC_SELL_END_TIME.split(':')
+        get_stocks_h, get_stocks_m = list(map(int, BAC_GET_STOCKS_TIME.split(':')))
+        buy_sh, buy_sm = list(map(int, BAC_BUY_START_TIME.split(':')))
+        buy_eh, buy_em = list(map(int, BAC_BUY_END_TIME.split(':')))
+        sell_sh, sell_sm = list(map(int, BAC_SELL_START_TIME.split(':')))
+        sell_eh, sell_em = list(map(int, BAC_SELL_END_TIME.split(':')))

stockbot does not keep track of stocks when you exit it

This really inhibits the usefulness of the application.
Would it be hard to have it load your current positions when it starts up?

I believe it also is the reason it throws the following error on startup:
2021-02-19T09:34:22.064436-05:00 selling stock if it goes up by 3%... Traceback (most recent call last): File "stockbot.py", line 638, in <module> main() File "stockbot.py", line 451, in main for stock in bought_stocks: UnboundLocalError: local variable 'bought_stocks' referenced before assignment

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.