Fixed stupid
This commit is contained in:
parent
0a9730d958
commit
75f42e7353
3 changed files with 2 additions and 3 deletions
|
@ -27,8 +27,6 @@ class Kraken:
|
||||||
|
|
||||||
# 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 calculateEMA(self, shortTime=round(time.time())-(7*24*3600), longTime=round(time.time())-(30*24*3600), interval=60):
|
def calculateEMA(self, shortTime=round(time.time())-(7*24*3600), longTime=round(time.time())-(30*24*3600), interval=60):
|
||||||
#self.prices = self.krakenWrapper.get_ohlc_data("XXBTZUSD", interval=interval, since=longTime)[0].close.iloc[::-1]
|
|
||||||
|
|
||||||
self.longEMA = self.prices.ewm(span=12).mean()
|
self.longEMA = self.prices.ewm(span=12).mean()
|
||||||
self.shortEMA = self.prices.ewm(span=3).mean()
|
self.shortEMA = self.prices.ewm(span=3).mean()
|
||||||
|
|
||||||
|
|
1
main.py
1
main.py
|
@ -26,6 +26,7 @@ if __name__ == "__main__":
|
||||||
new_row = pandas.DataFrame([[current_price]], index=[pandas.to_datetime(time.time(), unit = "s")])
|
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)
|
k.prices = pandas.concat([k.prices, pandas.DataFrame(new_row)], ignore_index=False)
|
||||||
|
k.calculateEMA()
|
||||||
|
|
||||||
# If we have crypto, check for sell behaviour, if we have fiat, check for buy behavior, otherwise, get really confused
|
# If we have crypto, check for sell behaviour, if we have fiat, check for buy behavior, otherwise, get really confused
|
||||||
if k.balances["vol"][currency_buy] > 10**-5:
|
if k.balances["vol"][currency_buy] > 10**-5:
|
||||||
|
|
2
plot.py
2
plot.py
|
@ -15,7 +15,7 @@ if __name__ == "__main__":
|
||||||
k.getBalances()
|
k.getBalances()
|
||||||
print("2")
|
print("2")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
k.getPrices(currency_pair)
|
k.getPrices(currency_pair, time=round(time.time())-(24*3600), interval=1)
|
||||||
print("3")
|
print("3")
|
||||||
k.calculateEMA()
|
k.calculateEMA()
|
||||||
print("4")
|
print("4")
|
||||||
|
|
Loading…
Reference in a new issue