Skip to content

Commit 8944547

Browse files
author
Shlomi Kushchi
authored
Merge pull request #309 from alpacahq/get_barset_example
Example using get_barset
2 parents 4027699 + f3c8f04 commit 8944547

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ account = api.get_account()
3636
api.list_positions()
3737
```
3838

39+
please note the exact format of the dates
40+
3941
## Example Scripts
4042

4143
Please see the `examples/` folder for some example scripts that make use of this API
@@ -131,6 +133,7 @@ You can access the following information through this object.
131133

132134
### Rest Examples
133135

136+
##### Using `submit_order()`
134137
Below is an example of submitting a bracket order.
135138
```py
136139
api.submit_order(
@@ -150,6 +153,21 @@ api.submit_order(
150153
)
151154
```
152155

156+
##### Using `get_barset()`
157+
```python
158+
import pandas as pd
159+
NY = 'America/New_York'
160+
start=pd.Timestamp('2020-08-01', tz=NY).isoformat()
161+
end=pd.Timestamp('2020-08-30', tz=NY).isoformat()
162+
print(api.get_barset(['AAPL', 'GOOG'], 'day', start=start, end=end).df)
163+
164+
# Minute data example
165+
start=pd.Timestamp('2020-08-28 9:30', tz=NY).isoformat()
166+
end=pd.Timestamp('2020-08-28 16:00', tz=NY).isoformat()
167+
print(api.get_barset(['AAPL', 'GOOG'], 'minute', start=start, end=end).df)
168+
169+
```
170+
153171
---
154172

155173
## StreamConn

0 commit comments

Comments
 (0)