Example #1
0
                            side='sell',
                            instrument_URL=instrument_URL,
                            symbol=symbol,
                            time_in_force=time_in_force,
                            stop_price=stop_price,
                            price=price,
                            quantity=quantity))


for i in range(1, 151):
    print('\033[' + str(i) + 'm' + str(i) + ': ABCDEFG' + '\033[0m')

config = Config(configure_file='../config.json')

rb = Robinhood()
if not rb.login(username=config.get_config('robinhood.username'),
                password=config.get_config('robinhood.password')):
    print('Login failed.')
    exit()

print("get_crypto_quotes")
currency_pairs = rb.get_crypto_currency_pairs()
currency_pair_by_id = {
    currency_pair['id']: currency_pair
    for currency_pair in currency_pairs
}

data = rb.get_crypto_quotes(currency_pair_ids=list(currency_pair_by_id.keys()))
data = rb.get_crypto_quotes(symbols=['BTCUSD'])
history = rb.get_crypto_historicals('BTCUSD', Intervals.FIVE_MINUTE,
                                    Spans.WEEK, Bounds.TWENTYFOUR_SEVEN)
Example #2
0

def process_data():
    stock_quotes = rbh.quotes_data([symbol for symbol in stocks])
    fundamentals = {symbol: rbh.get_fundamentals(symbol) for symbol in stocks}

    statistics.stocks_details_output(stocks, stock_quotes, fundamentals,
                                     interval, checkpoint_rates,
                                     period_samples)
    # statistics.store_data(stock_quotes)


config = Config(configure_file='../config.json')
rbh = Robinhood()

interval = config.get_config('fetch_interval')

checkpoint_rates = statistics.build_checkpoints(stocks)
period_samples = statistics.init_period_sample_sequence(stocks)

if not rbh.login(username=config.get_config('robinhood.username'),
                 password=config.get_config('robinhood.password')):
    print('Login failed.')
    exit()

scheduler = BlockingScheduler()
job = scheduler.add_job(process_data, 'interval', seconds=interval)
scheduler.start()

rbh.logout()