Exemple #1
0
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()
Exemple #2
0
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)
Exemple #3
0
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)
Exemple #4
0
    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)
Exemple #5
0
    - 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)
Exemple #6
0
      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()
Exemple #7
0
            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()
Exemple #8
0
    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)