CryptoBot/plot.py

33 lines
595 B
Python
Raw Normal View History

2021-02-03 17:00:44 -05:00
import time, threading, pandas
2021-02-01 22:34:35 -05:00
import matplotlib.pyplot as plt
from api.kraken import Kraken
from api.fake import Fake
if __name__ == "__main__":
currency_buy = "XXBT"
currency_sell = "ZUSD"
currency_pair = "XXBTZUSD"
k = Kraken()
2021-02-03 16:15:05 -05:00
print(1)
2021-02-01 22:34:35 -05:00
time.sleep(1)
2021-02-03 16:15:05 -05:00
2021-02-03 17:00:44 -05:00
k.get_ohlc_prices(currency_pair, time=round(time.time())-(24*3600), interval=1)
2021-02-03 16:15:05 -05:00
print(2)
time.sleep(1)
2021-02-03 17:00:44 -05:00
k.get_current_price(currency_pair)
2021-02-03 16:15:05 -05:00
print(3)
2021-02-03 17:00:44 -05:00
k.calculate_ema()
2021-02-03 16:15:05 -05:00
print(4)
2021-02-01 22:34:35 -05:00
2021-02-03 17:00:44 -05:00
plt.plot(k.short_ema)
plt.plot(k.long_ema)
2021-02-01 22:34:35 -05:00
plt.plot(k.prices)
plt.show()