From 1d26f843527597483813be04f1e3b803dd60f2ae Mon Sep 17 00:00:00 2001 From: Rahul Chowdhury Date: Wed, 27 Jul 2022 09:04:43 -0400 Subject: [PATCH] Improve example README --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d1f7e9a1..cf1ada35 100644 --- a/README.md +++ b/README.md @@ -61,25 +61,25 @@ Some examples of request models corresponding to methods: * ``GetOrdersRequest`` for ``TradingClient.get_orders()`` * ``CryptoLatestOrderbookRequest`` for ``CryptoHistoricalDataClient.get_crypto_latest_orderbook()`` -**Usage Example** +**Request Models Usage Example** -To submit an order, you will need to provide a `MarketOrderRequest` object. +To get historical bar data for crypto, you will need to provide a ``CryptoBarsRequest`` object. ```python -from alpaca.trading.client import TradingClient -from alpaca.trading.requests import MarketOrderRequest -from alpaca.trading.enums import OrderSide, TimeInForce +from alpaca.data.historical import CryptoHistoricalDataClient +from alpaca.data.requests import CryptoBarsRequest +from alpaca.data.timeframe import TimeFrame -client = TradingClient('api-key', 'secret-key') +# no keys required for crypto data +client = CryptoHistoricalDataClient() -request_params = MarketOrderRequest( - symbol="SPY", - qty=3, - side=OrderSide.BUY, - time_in_force=TimeInForce.DAY - ) +request_params = CryptoBarsRequest( + symbol_or_symbols=["BTC/USD", "ETH/USD"], + timeframe=TimeFrame.Day, + start="2022-07-01" + ) -client.submit_order(order_data=request_params) +bars = client.get_crypto_bars(request_params) ``` ### Data Validation