More updates
This commit is contained in:
parent
7ca8f57c72
commit
fcd3f76702
2 changed files with 5 additions and 7 deletions
|
@ -15,7 +15,7 @@ class Kraken:
|
|||
|
||||
|
||||
# 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]
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ class Kraken:
|
|||
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.
|
||||
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.short_ema = self.prices.ewm(span=short_time).mean()
|
||||
|
||||
|
|
8
plot.py
8
plot.py
|
@ -1,20 +1,18 @@
|
|||
import time, threading, pandas
|
||||
import time, threading, pandas, sys
|
||||
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"
|
||||
currency_pair = sys.argv[1]
|
||||
|
||||
k = Kraken()
|
||||
print(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)
|
||||
|
||||
time.sleep(1)
|
||||
|
|
Loading…
Reference in a new issue