1
0
mirror of https://github.com/bspeice/metrik synced 2025-07-01 05:46:22 -04:00

Add fetching options quotes (daily data from Tradeking)

This commit is contained in:
bspeice
2016-11-24 18:27:29 -05:00
parent fb023e0dea
commit 6fc85653cb
2 changed files with 52 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import pytest
from six.moves import map
from pytz import utc
from metrik.tasks.tradeking import Tradeking1mTimesales, TradekingOptionsQuotes, TradekingApi
from metrik.tasks.tradeking import Tradeking1mTimesales, TradekingOptionsQuotes, TradekingApi, batch
from metrik.trading_days import TradingDay
from metrik.targets.mongo import MongoTarget
from test.mongo_test import MongoTest
@ -40,6 +40,7 @@ def test_returns_verifiable(ticker):
assert_allclose(tradeking_ohlc, yahoo_ohlc, rtol=1e-3)
@pytest.mark.parametrize('ticker', [
'AAPL', 'GOOG', 'SPY', 'REGN', 'SWHC', 'BAC', 'NVCR', 'ARGT'
])
@ -49,8 +50,20 @@ def test_chain_returns(ticker):
assert len(chain) > 20
class TradekingTest(MongoTest):
@pytest.mark.parametrize('ticker', [
'AAPL', 'GOOG', 'SPY'
])
def test_options_quote(ticker):
demo_length = 25
api = TradekingApi()
chain = TradekingOptionsQuotes.retrieve_chain_syms(api, ticker)[:demo_length]
quotes = TradekingOptionsQuotes.retrieve_quotes(api, chain)
assert len(quotes) == demo_length
class TradekingTest(MongoTest):
def test_record_is_saveable(self):
# Had an issue previously where the `date` type would cause saving
# to fail. Make sure that doesn't continue