Beispiel #1
0
def get_quote():
    client_config = get_client_config()
    quote_client = QuoteClient(client_config)
    quote_client.get_market_status(Market.US)
    quote_client.get_briefs(symbols=['AAPL', '00700', '600519'],
                            include_ask_bid=True,
                            right=QuoteRight.BR)
    #quote_client.get_timeline('AAPL', period=TimelinePeriod.DAY, include_hour_trading=True)
    return quote_client.get_bars('AAPL')
Beispiel #2
0
openapi_client = QuoteClient(client_config, logger=logger)


def get_option_quote():
    symbol = 'AAPL'
    expirations = openapi_client.get_option_expirations(symbols=[symbol])
    if len(expirations) > 1:
        print(expirations)
        expiry = int(
            expirations[expirations['symbol'] == symbol].at[0, 'timestamp'])
        chains = openapi_client.get_option_chain(symbol, expiry)
        print(chains)
    for index, row in chains.iterrows():
        print(row["identifier"], row["strike"], row["put_call"])
    briefs = openapi_client.get_option_briefs(['AAPL  190906C00215000'])
    print(briefs)
    bars = openapi_client.get_option_bars(['AAPL  190906C00215000'])
    print(bars)
    ticks = openapi_client.get_option_trade_ticks(['AAPL  190906C00215000'])
    print(ticks)
    for index, row in ticks.iterrows():
        print(row["identifier"], row["time"], row["price"])


if __name__ == "__main__":
    symbols = ["goog", "baba"]
    info = openapi_client.get_briefs(symbols)
    get_option_quote()
    # print(openapi_client.get_trade_metas(symbols))
    # print(openapi_client.get_short_interest(symbols))