Szóval ez itt egy python script ami figyeli a coinmarketcap-on a coinok volume-jét.
Sajnos csak USD Volume-ot figyel, tehát van még mit fejleszteni rajta (pl a coinvolusd = itm['24h_volume_usd'] résznél figyelembe kéne venni a BTC aktuális árát, így kevesebb lenne a false alert amikor emlkedik a BTC)
Érdemes még az analysecoinvolumerise okosabbá tenni, jelenleg csak a volume-ra figyel, nézhetné még pl hogy éppen DIP van-e, vagy ugrik-e az ár fölfele stb ...
A klasszikus technical analysis-t is hozzá lehetne csapni, akkor már érdekesebb lenne, de egyelőre nem volt még időm vele foglalkozni.
Kis rizsa a scripthez:
data könyvtárat létre kell hozni ott ahova a fájlt másolod
ez a lényege: analysecoinvolumerise(coinsymbol, 20, 1.2, 20)
3 percenként vesz sample t
és 20 sample kell neki ha a második paraméter 20
tehát az első 1 óráig semmit sem fog analizálni
1.2 : legalább ennyivel emelkedjen 1 óra alatt a volume (1.2 = 20%)
utolsó paraméter a trend kiértékelésnél fontos: a mintavételek közti külömbség legalább 20%-a mutasson emelkedő trendet
a script:
Code
"""
CoinMarketCap volume watcher
"""
import urllib
import json
import csv
from time import sleep
urlstr = "https://api.coinmarketcap.com/v1/ticker/?limit=200"
datadir = "data"
i = 1
dly = 180
temphistdata = {}
histdata = []
def analysecoinvolumerise(coinsym, samplenum, expectedvolumeinc, minrisepercent):
"""
function analysecoinvolumerise
Analyses if there is a rising trend in the trade volume
parameters:
coinsym: symbol of coin
samplenum: last n items in array
expectedvolumeinc: minimum expected rise between the first and last element in the array
minrisepercent: percent of numbers should be bigger than 0 (rising trend) in the trend array
"""
volumelist = []
coinfilename = 'data\\' + coinsym
with open(coinfilename, 'rb') as csvfile:
csvreader = csv.reader(csvfile, delimiter=',')
for row in csvreader:
volumelist.append(float(row[1]))
if len(volumelist) > samplenum:
volumelist = volumelist[-samplenum:] #get only last n items
firstvol = volumelist[0]
lastvol = volumelist[len(volumelist)-1]
expectedvolume = firstvol * expectedvolumeinc
if lastvol > expectedvolume:
changevol = lastvol - firstvol
changevolpercent = changevol / firstvol * 100
#trend analysis: subtract number from previous number in the array:
trend = [b - a for a, b in zip(volumelist[::1], volumelist[1::1])]
risingnum = sum(i > 0 for i in trend)
risepercent = float(risingnum / float(len(trend))) * 100
if risepercent > minrisepercent:
print coinsym + ": Trading volume increased by " + str(changevolpercent) + "%" + " samplecount: " + str(samplenum)
#else:
#print "last volume of " + str(lastvol) + " is smaller than expected value: " + str(expectedvolume)
#else:
#print "Nothing to analyse yet. Need " + str(samplenum) + " samples"
while True:
print i
response = urllib.urlopen(urlstr)
jsondata = json.loads(response.read())
for itm in jsondata:
coinsymbol = itm['symbol']
coinvolusd = itm['24h_volume_usd']
filename = datadir + "\\" + coinsymbol
coininfo = str(i) + "," + coinvolusd + "\n"
with open(filename, "a") as myfile:
myfile.write(coininfo)
analysecoinvolumerise(coinsymbol, 20, 1.2, 20)
sleep(dly)
i = i+1
/e tényleg nagyon keveset foglalkozok pythonnal pls no bully
/e2 régről van még poloniex trader bot is, de sosem termelt igazán profitot, így nem fejlesztettem tovább
Ja és ha valaki ilyesmit akar futtatni 24/7-ben akkor Amazon AWS-en ingyé adnak 1 évig egész jó kis linux virtuális szervert
This post was edited by ace17alreadyexists on Jan 4 2018 02:46pm