Skip to content

Commit

Permalink
Removed the deprecated get_option_chain parameters strike_from_date
Browse files Browse the repository at this point in the history
… and `strike_to_date` (#212)
  • Loading branch information
alexgolec authored Apr 30, 2021
1 parent a80f8af commit 398cd94
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 53 deletions.
20 changes: 0 additions & 20 deletions tda/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,6 @@ def get_option_chain(
interval=None,
strike=None,
strike_range=None,
strike_from_date=None,
strike_to_date=None,
from_date=None,
to_date=None,
volatility=None,
Expand Down Expand Up @@ -642,24 +640,6 @@ def get_option_chain(
:param option_type: Types of options to return. See
:class:`Options.Type` for choices.
'''
if strike_from_date:
warnings.warn(
'The strike_from_date argument is deprecated and will be ' +
'removed in a future version of tda-api. Please use ' +
'from_date instead.', Warning)
assert from_date is None, \
'strike_from_date and from_date cannot be set simultaneously'
from_date = strike_from_date

if strike_to_date:
warnings.warn(
'The strike_to_date argument is deprecated and will be ' +
'removed in a future version of tda-api. Please use ' +
'to_date instead.', Warning)
assert to_date is None, \
'strike_to_date and to_date cannot be set simultaneously'
to_date = strike_to_date

contract_type = self.convert_enum(
contract_type, self.Options.ContractType)
strategy = self.convert_enum(strategy, self.Options.Strategy)
Expand Down
33 changes: 0 additions & 33 deletions tests/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,22 +876,6 @@ def test_get_option_chain_from_date_str(self):
"from_date, got 'builtins.str'")


def test_get_option_chain_strike_from_date_date(self):
self.client.get_option_chain('AAPL', strike_from_date=NOW_DATE)
self.mock_session.get.assert_called_once_with(
self.make_url('/v1/marketdata/chains'), params={
'apikey': API_KEY,
'symbol': 'AAPL',
'fromDate': NOW_DATE_ISO})

def test_get_option_chain_strike_from_date_and_from_date(self):
with self.assertRaises(AssertionError) as err:
self.client.get_option_chain(
'AAPL', strike_from_date=NOW_DATE, from_date=NOW_DATE)
self.assertEqual(str(err.exception),
'strike_from_date and from_date cannot be set simultaneously')


def test_get_option_chain_to_date_datetime(self):
self.client.get_option_chain('AAPL', to_date=NOW_DATETIME)
self.mock_session.get.assert_called_once_with(
Expand All @@ -918,23 +902,6 @@ def test_get_option_chain_to_date_str(self):
"to_date, got 'builtins.str'")


def test_get_option_chain_strike_to_date_date(self):
self.client.get_option_chain('AAPL', strike_to_date=NOW_DATE)
self.mock_session.get.assert_called_once_with(
self.make_url('/v1/marketdata/chains'), params={
'apikey': API_KEY,
'symbol': 'AAPL',
'toDate': NOW_DATE_ISO})


def test_get_option_chain_strike_to_date_and_to_date(self):
with self.assertRaises(AssertionError) as err:
self.client.get_option_chain(
'AAPL', strike_to_date=NOW_DATE, to_date=NOW_DATE)
self.assertEqual(str(err.exception),
'strike_to_date and to_date cannot be set simultaneously')


def test_get_option_chain_volatility(self):
self.client.get_option_chain('AAPL', volatility=40.0)
self.mock_session.get.assert_called_once_with(
Expand Down

0 comments on commit 398cd94

Please sign in to comment.