36 lines
837 B
Python
36 lines
837 B
Python
import time, threading
|
|
import matplotlib.pyplot as plt
|
|
import pandas
|
|
|
|
from api.kraken import Kraken
|
|
from api.fake import Fake
|
|
|
|
if __name__ == "__main__":
|
|
currency_buy = "XXBT"
|
|
currency_sell = "ZUSD"
|
|
currency_pair = "XXBTZUSD"
|
|
|
|
k = Kraken()
|
|
print(1)
|
|
|
|
time.sleep(1)
|
|
|
|
k.getPrices(currency_pair, time=round(time.time())-(24*3600), interval=1)
|
|
print(2)
|
|
|
|
time.sleep(1)
|
|
|
|
current_price = float(k.krakenWrapper.get_ticker_information(currency_pair)["c"][0][0])
|
|
new_row = pandas.DataFrame([[current_price]], index=[pandas.to_datetime(time.time(), unit = "s")])
|
|
|
|
k.prices = pandas.concat([k.prices, pandas.DataFrame(new_row)], ignore_index=False)
|
|
print(3)
|
|
|
|
k.calculateEMA()
|
|
print(4)
|
|
|
|
plt.plot(k.shortEMA)
|
|
plt.plot(k.longEMA)
|
|
plt.plot(k.prices)
|
|
plt.show()
|
|
|