def RunCommon(): '''Do the following forever: - Configure DB - Make candles based on gc.Candles.Size. - Make a candle price list - Run indicators specified in gc.IndicatorList''' ldb.PopulateRow() ldb.ExtractUsefulLists() for indicator in gc.IndicatorList: getattr(indicators, indicator).indicator() strategies.Generic() if gc.Simulator.Enabled: sim.SimulateFromStrategy() if gc.Trader.Enabled: trd.TradeFromStrategy() if gc.Trader.ReIssue: if not trd.LastOrder == 'N': gu.do_every(gc.Trader.ReIssueDelay, trd.ReIssueTrade, gc.Trader.ReIssueMax) if gc.Grapher.Enabled and not nograph: grapher.Price() grapher.Indicator()
def RCWrapper(): if avarice.RCruns < 2: if avarice.RCruns == 1: PrintEstimate() storage.indicators.CreateShelveName() no.Wrapper.Run() if not gc.API.Verbose: print('Connecting to OKCoin WebSocket(s)...') RunCommon() else: if ldb.ThreadWait > 0: print('Waiting', gu.PrettyMinutes(ldb.ThreadWait - 6, 2), 'minutes to resume on schedule') if ldb.ThreadWait - 6 > 0: time.sleep(ldb.ThreadWait - 6) elif not gc.Database.Debug: gu.SilentRemove(storage.indicators.indshelve) gu.do_every(ldb.CandleSizeSeconds, RunCommon)
loggerdb.PopulateRow() loggerdb.ExtractUsefulLists() for indicator in genconfig.IndicatorList: getattr(indicators, indicator).indicator() strategies.Generic() if genconfig.Simulator.Enabled: simulator.SimulateFromIndicator() if genconfig.Trader.Enabled: trader.TradeFromIndicator() if genconfig.Grapher.Enabled and not nograph: grapher.Price() grapher.Indicator() # RunAll automatically if avarice is run directly if __name__ == '__main__': # Sometimes we do not want to drop table for debugging. # This *should never* be used in standard runtime if not genconfig.Database.Debug: loggerdb.ConfigureDatabase() if genconfig.TradeRecorder.Enabled: genutils.PrepareRecord() if loggerdb.ThreadWait > 0: print('Waiting', genutils.PrettyMinutes(loggerdb.ThreadWait, 2), 'minutes to resume on schedule') time.sleep(loggerdb.ThreadWait) genutils.do_every(loggerdb.CandleSizeSeconds, RunCommon)
- Run indicators specified in genconfig.IndicatorList''' loggerdb.PopulateRow() loggerdb.ExtractUsefulLists() for indicator in genconfig.IndicatorList: getattr(indicators, indicator).indicator() strategies.Generic() if genconfig.Simulator.Enabled: simulator.SimulateFromIndicator() if genconfig.Trader.Enabled: trader.TradeFromIndicator() if genconfig.Grapher.Enabled and not nograph: grapher.Price() grapher.Indicator() # RunAll automatically if avarice is run directly if __name__ == '__main__': # Sometimes we do not want to drop table for debugging. # This *should never* be used in standard runtime if not genconfig.Database.Debug: loggerdb.ConfigureDatabase() if genconfig.TradeRecorder.Enabled: genutils.PrepareRecord() if loggerdb.ThreadWait > 0: print('Waiting', genutils.PrettyMinutes(loggerdb.ThreadWait, 2), 'minutes to resume on schedule') time.sleep(loggerdb.ThreadWait) genutils.do_every(loggerdb.CandleSizeSeconds, RunCommon)
storage.indicators.CreateShelveName() no.Wrapper.Run() if not gc.API.Verbose: print('Connecting to OKCoin WebSocket(s)...') RunCommon() else: if ldb.ThreadWait > 0: print('Waiting', gu.PrettyMinutes(ldb.ThreadWait - 6, 2), 'minutes to resume on schedule') if ldb.ThreadWait - 6 > 0: time.sleep(ldb.ThreadWait - 6) elif not gc.Database.Debug: gu.SilentRemove(storage.indicators.indshelve) gu.do_every(ldb.CandleSizeSeconds, RunCommon) # RunAll automatically if avarice is run directly if __name__ == '__main__': # Sometimes we do not want to drop table for debugging. # This *should never* be used in standard runtime if not gc.Database.Debug: ldb.ConfigureDatabase() RCWrapper() gu.do_every(6, RCWrapper, 2) loop = asyncio.get_event_loop() if gc.Trader.Enabled: asyncio.async(trd.TradeWrapper()) if el.AdditionalAsync: for i in el.AdditionalAsync: asyncio.async(i) loop.run_forever()
no.Wrapper.Run() if not gc.API.Verbose: print('Connecting to OKCoin WebSocket(s)...') RunCommon() else: if ldb.ThreadWait > 0: print('Waiting', gu.PrettyMinutes(ldb.ThreadWait - 6, 2), 'minutes to resume on schedule') if ldb.ThreadWait - 6 > 0: time.sleep(ldb.ThreadWait - 6) elif not gc.Database.Debug: gu.SilentRemove(storage.indicators.indshelve) gu.do_every(ldb.CandleSizeSeconds, RunCommon) # RunAll automatically if avarice is run directly if __name__ == '__main__': # Sometimes we do not want to drop table for debugging. # This *should never* be used in standard runtime if not gc.Database.Debug: ldb.ConfigureDatabase() RCWrapper() gu.do_every(6, RCWrapper, 2) loop = asyncio.get_event_loop() if gc.Trader.Enabled: asyncio. async (trd.TradeWrapper()) if el.AdditionalAsync: for i in el.AdditionalAsync: asyncio. async (i) loop.run_forever()
for indicator in gc.IndicatorList: getattr(indicators, indicator).indicator() strategies.Generic() if gc.Simulator.Enabled: sim.SimulateFromStrategy() if gc.Trader.Enabled: trd.TradeFromStrategy() if gc.Trader.ReIssue: if not trd.LastOrder == 'N': gu.do_every(gc.Trader.ReIssueDelay, trd.ReIssueTrade, gc.Trader.ReIssueMax) if gc.Grapher.Enabled and not nograph: grapher.Price() grapher.Indicator() # RunAll automatically if avarice is run directly if __name__ == '__main__': # Sometimes we do not want to drop table for debugging. # This *should never* be used in standard runtime if not gc.Database.Debug: ldb.ConfigureDatabase() if gc.TradeRecorder.Enabled: gu.PrepareRecord() if ldb.ThreadWait > 0: print('Waiting', gu.PrettyMinutes(ldb.ThreadWait, 2), 'minutes to resume on schedule') time.sleep(ldb.ThreadWait) gu.do_every(ldb.CandleSizeSeconds, RunCommon)