Skip to content

Latest commit

 

History

History
95 lines (70 loc) · 3.25 KB

README.md

File metadata and controls

95 lines (70 loc) · 3.25 KB

trader_bot

This is a simple api to get information of stocks at stock market. Custom price notifications given high and low thresholds.

Setup

  1. Create your telegram bot. Follow instructions.
  2. Get you telegram chat id.
$ git clone https://github.com/emichester/trader_API.git
$ cd trader_API
$ mkdir config && touch config/data.py && touch config/stock_list.py && touch config/RPi_utils.py && touch config/crypto_list.py
$ echo "
TOKEN = 'your-bot-token'
MI_CHAT_ID = you-chat-id ### int format e.g. 123456789
" > config/data.py
$ echo "
RPi_relax_time = 10.0
# you have a limit of 2000 requests/hour or 48000 requests/day (market open 9 h/day)
# time_h >= Nºstock * 3600 / 2000 --------> per hour
# time_d >= Nºstock * 3600 * 9 / 48000 ---> per day
# 
# RPi_relax_time = max(time_h,time_d)

CRYPTO_time = 10.0

NOTIFICATION_TIME = 5.0*60
" > config/RPi_utils.py # if you overpass the limit you won't get the web actualized
$ chmod +x simple_telegram_advisor.py

Install requirements.txt

$ pip3 install -r requirements.txt

If you don't have pip install it (python3-pip).

Usage of stock notifications

Open "config/stock_list.py" and modify the dictionary as you want. For example:

stocks = {
    "GME" : {'high' : 225.0 , 'low' : 170.0 },
    "AMC" : {'high' : 14.0 , 'low' : 9.0},
    "PLUG" : {'high' : 40.0 , 'low' : 30.0},
}

Finally run the bot with the following comand.

$ ./simple_telegram_advisor.py

Change the RPi_relax_time in the file "config/RPi_utils.py" deppending on the CPU usage you want to be used and if you need very high precision use RPi_relax_time = 0.0 (if you use a regular PC use 0.0 also).

IMPORTANT!!! if you overpass the requests limit you won't get the web actualized.

Usage of crypto notifications

Open "config/crypto_list.py" and modify the dictionary as you want. For example:

cryptos = {
	"DOGE-USD" : {'high' : 0.45 , 'low' : 0.33},
    "BTC-USD" : {'high' : 70000.0 , 'low' : 60000.0},
}

Finally run the bot with the following comand.

$ ./simple_telegram_advisor_cryptos.py

Change the CRYPTO_time in the file "config/RPi_utils.py" deppending on the CPU usage you want to be used and if you need very high precision use CRYPTO_time = 10 (if you use a regular PC use 0.0 also).

IMPORTANT!!! if you overpass the requests limit you won't get the web actualized.

ToDo

  • Buy notice
  • Sell notice
  • After-hours and pre-market report and analysis
  • Threaded version