The resource loading... loading...

Chasing and killing

Author: ChildeTang, Date: 2018-06-06 14:30:28
Tags: TrendPython


list=[]

def doTicker():
    #Log(exchange.GetAccount())
    #Log(list)
    ticker = exchange.GetTicker()
    last = ticker.Last
    if len(list) < LENGTH:
        list.append(last)
    else:
        pMax = max(list)
        pMin = min(list)
        if last > pMax:
            Log("buy " + str(exchange.GetAccount()))
            account = exchange.GetAccount()
            if account.Balance > last:
                #id = exchange.Buy(last, 1)
                id = exchange.Buy(-1, 1)
                Log("buy id --> " + str(id))
        elif last < pMin:
            Log("sell " + str(exchange.GetAccount()))
            account = exchange.GetAccount()
            if account.Stocks > 0:
                #id = exchange.Sell(last, 1)
                id = exchange.Sell(-1, 1)
                Log("sell id --> " + str(id))
        list.pop(0)
        list.append(last)

def main():
    while(true):
        doTicker() #执行策略
        Sleep(PERIOD * 1000) #休息一段时间


Related

More

It's called the Everglades.if len ((list) < LENGTH, what is this LENGTH?

bbThanks to Childe Tang, I think you're doing a good job, can you leave a link? The newcomer has also written a comment for himself, if there are any problems, please point them out. https://dn-filebox.qbox.me/0dfac0b5f5087f1af7760f657e934101c764116b.png

sltrainCan you judge the trend by the thresholds of the first 1,440 transactions?

ChildeTang https://dn-filebox.qbox.me/6eea75a00f671795038b8844f7e32a770f0a68c8.png

FlyingonThis tactic is not a waste of money, is it useful?

ChildeTangI'm not sure what you mean by that.

Little blackIs the author there?

amazingriekyIs there a problem with this tactic, is there no stopping it?

ChildeTangThis is not to say that sometimes the test is stupid, who knows?