More updates

This commit is contained in:
Logan G 2021-02-05 22:09:58 -07:00
parent 7ca8f57c72
commit fcd3f76702
Signed by: logan
GPG key ID: E328528C921E7A7A
2 changed files with 5 additions and 7 deletions

View file

@ -15,7 +15,7 @@ class Kraken:
# Gets a table of the price history of the pair since time at intervals of interval minutes # Gets a table of the price history of the pair since time at intervals of interval minutes
def get_ohlc_prices(self, pair, time=round(time.time())-(30*24*3600), interval=60): def get_ohlc_prices(self, pair, time=round(time.time())-(20*24*3600), interval=20):
self.prices = self.kraken_wrapper.get_ohlc_data(pair, interval=interval, since=time)[0].close.iloc[::-1] self.prices = self.kraken_wrapper.get_ohlc_data(pair, interval=interval, since=time)[0].close.iloc[::-1]
@ -30,7 +30,7 @@ class Kraken:
self.fee = self.kraken_wrapper.get_tradable_asset_pairs(pair=pair)["fees"][0][0][1] self.fee = self.kraken_wrapper.get_tradable_asset_pairs(pair=pair)["fees"][0][0][1]
# Calculates the exponential moving average by grabbing data from Kraken on the conversion rate every interval minutes. # Calculates the exponential moving average by grabbing data from Kraken on the conversion rate every interval minutes.
def calculate_ema(self, short_time=5, long_time=30): def calculate_ema(self, short_time=10, long_time=20):
self.long_ema = self.prices.ewm(span=long_time).mean() self.long_ema = self.prices.ewm(span=long_time).mean()
self.short_ema = self.prices.ewm(span=short_time).mean() self.short_ema = self.prices.ewm(span=short_time).mean()

View file

@ -1,20 +1,18 @@
import time, threading, pandas import time, threading, pandas, sys
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from api.kraken import Kraken from api.kraken import Kraken
from api.fake import Fake from api.fake import Fake
if __name__ == "__main__": if __name__ == "__main__":
currency_buy = "XXBT" currency_pair = sys.argv[1]
currency_sell = "ZUSD"
currency_pair = "XXBTZUSD"
k = Kraken() k = Kraken()
print(1) print(1)
time.sleep(1) time.sleep(1)
k.get_ohlc_prices(currency_pair, time=round(time.time())-(24*3600), interval=1) k.get_ohlc_prices(currency_pair, time=round(time.time())-(72*3600), interval=1)
print(2) print(2)
time.sleep(1) time.sleep(1)