def SvcDoRun(self): try: self.ReportServiceStatus(win32service.SERVICE_RUNNING) log.ok("Running %s Gemini version %s" % (config.MODE, pkg_resources.get_distribution("gemini").version,)) bot_thread = GeminiThread(Gemini(config)) bot_thread.start() win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) bot_thread.stop() except Exception as exc: log.error("SvcDoRun exception: %s" % (traceback.format_exc(),))
'date': today['date'], 'price': current_price, 'rsi': rsi[-1], }) # Data settings pair = "ETC_BTC" # Use ETH pricing data on the BTC market period = 300 # Use 1800 second candles days_history = 30 # From there collect 60 days of data RSI_OPEN = 55 RSI_DEVIATION = 10 RSI_PERIOD = 14 # Request data from Poloniex df = px.load_dataframe(pair, period, days_history) # Algorithm settings sim_params = { 'capital_base': 1, 'data_frequency': '30T', 'fee': { 'Long': 0.0025, 'Short': 0.0025, } } gemini = Gemini(logic=logic, sim_params=sim_params, analyze=None) gemini.run(df)
for position in algo.account.positions: if position.type_ == 'Long': algo.account.close_position(position, 1, exit_price) if today['close'] > yesterday['close']: entry_capital = algo.account.buying_power if entry_capital > 0.0001: algo.account.enter_position('Long', entry_capital, today['close']) # Data settings pair = ['ETH', 'BTC'] # Use ETH pricing data on the BTC market days_history = 360 # From there collect X days of data exchange = 'Bitfinex' # Request data from cryptocompare.com df = cc.load_dataframe(pair, days_history, exchange) # Algorithm settings sim_params = { 'capital_base': 1000, 'fee': { 'Long': 0.0025 + 0.001, # fee + spread 'Short': 0.0025 + 0.001, } } r = Gemini(logic=logic, sim_params=sim_params, analyze=analyze_mpl) # start backtesting custom logic with 1000 (BTC) intital capital r.run(df, title='History: {}'.format(days_history), show_trades=True)
###### ###### # get data from file stored on disk start_date = '2017-01-04 0:00:00' end_date = '2017-12-31 23:59:59' base_currency = 'BTC' other_currency = 'XRP' frequency = '1D' df = get_historical_data_from_file(base_currency, other_currency, frequency, start_date, end_date) ######## # Algorithm settings sim_params = { 'capital_base': 10, # initial capital in BTC 'fee': { 'Long': 0.0015, # fee settings for Long 'Short': 0.0015, # fee settings for Short }, 'data_frequency': '1D' # Time frame to use (see /helpers/timeframe_resampler.py for more info } gemini = Gemini(logic=logic, sim_params=sim_params, analyze=analyze_bokeh) # start backtesting custom logic with 10 (BTC) intital capital gemini.run(df, show_trades=True)
'long': long[-1], }) # Data settings pair = "ETH_BTC" # Use ETH pricing data on the BTC market period = 1800 # Use 1800 second candles days_history = 300 # From there collect 60 days of data # Request data from Poloniex df = px.load_dataframe(pair, period, days_history) # Algorithm settings sim_params = { 'capital_base': 10, 'fee': { 'Long': 0.0025, 'Short': 0.0025, }, 'data_frequency': '30T' } gemini = Gemini(initialize=initialize, logic=logic, sim_params=sim_params, analyze=analyze_bokeh) # start backtesting custom logic with 10 (BTC) intital capital gemini.run(df, title='SMA Cross {}: {}'.format(pair, days_history), show_trades=True)
algo.records.append({ 'date': algo.account.date, 'price': current_price, 'sma20': short[-1], 'sma100': long[-1], }) pair = ['BTC', 'USD'] # Use ETH pricing data on the BTC market days_history = 300 # From there collect X days of data exchange = 'Bitstamp' # Request data from cryptocompare.com df = cc.load_dataframe(pair, days_history, exchange) # Algorithm settings sim_params = { 'capital_base': 10000, 'fee': { 'Long': 0.0025 + 0.001, # fee + spread 'Short': 0.0025 + 0.001, } } gemini = Gemini(logic=logic, sim_params=sim_params, analyze=analyze_bokeh) # start backtesting custom logic with 1000 (BTC) intital capital gemini.run(df, title='SMA 5x30 History: {}'.format(days_history), show_trades=True)
def run(): distrib = pkg_resources.get_distribution("gemini") log.ok("Running %s Gemini version %s" % (config.MODE, distrib.version if distrib else "UNVERSIONED")) bot = Gemini(config) bot.start()
algo.records.append({ 'date': today['date'], 'rsi': rsi[-1], }) # Data settings pair = "ETC_BTC" # Use ETH pricing data on the BTC market period = 300 # Use 1800 second candles days_history = 30 # From there collect 60 days of data RSI_OPEN = 55 RSI_DEVIATION = 10 RSI_PERIOD = 14 # Request data from Poloniex df = px.load_dataframe(pair, period, days_history) # Algorithm settings sim_params = { 'capital_base': 1, 'data_frequency': '30T', 'fee': { 'Long': 0.0025, 'Short': 0.0025, } } gemini = Gemini(logic=logic, sim_params=sim_params, analyze=analyze_mpl) gemini.run(df)