Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Updates readme Quickstart section to include passing `calendars` and
`dealys` if Yahoo API not fully available.
  • Loading branch information
maread99 committed Oct 27, 2023
1 parent 75a620e commit f29b76b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ $ pip install market-prices
```python
>>> from market_prices import PricesYahoo
>>> prices = PricesYahoo("MSFT") # prices for a single instrument, Microsoft
>>> # OR if Yahoo API endpoints are not all currently available in your region...
>>> prices = PricesYahoo("MSFT", calendars="XNYS", delays=0)
>>> prices.get("5min", minutes=40) # last 40 minutes of prices at 5 minute intervals
```
```
Expand Down Expand Up @@ -100,6 +102,10 @@ Although some indices are longer than three calendar days, they all comprise of
```python
>>> # Get a prices instance for Microsoft in New York, Alibaba in Hong Kong and 24/7 Bitcoin
>>> prices_mult = PricesYahoo("MSFT, 9988.HK, BTC-USD")
>>> # OR if Yahoo API endpoints are not all currently available in your region...
>>> prices_mult = PricesYahoo(
"MSFT, 9988.HK, BTC-USD", calendars=["XNYS", "XHKG", "24/7"], delays=[0, 15, 0]
)
>>> # lead_symbol determines the exchange against which the period will be evaluated and
>>> # the default output time zone (which for Bitcoin is UTC).
>>> prices_mult.get("90T", hours=9, lead_symbol="BTC-USD")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_yahoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ def prices(
api_working = True
try:
prices = m.PricesYahoo(symbols)
except m.YahooAPIError:
except (m.YahooAPIError, ValueError):
prices = m.PricesYahoo(symbols, calendars=calendars, delays=delays)
api_working = False
yield prices, api_working
Expand Down

0 comments on commit f29b76b

Please sign in to comment.