Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.10", "3.11", "3.12" ]

steps:

Expand Down
9 changes: 0 additions & 9 deletions tests/test_historical_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def test_historical_prices_v3_datetime_happy(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json=response_body,
status=200,
Expand Down Expand Up @@ -95,7 +94,6 @@ def test_historical_prices_v3_num_points_happy(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json=response_body,
status=200,
Expand Down Expand Up @@ -126,7 +124,6 @@ def test_historical_prices_v3_num_points_bad_numpoints(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json={
"errorCode": "Unable to convert value=3.14159 to type= Integer int"
Expand All @@ -151,7 +148,6 @@ def test_historical_prices_v3_num_points_bad_resolution(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json=response_body,
status=200,
Expand Down Expand Up @@ -235,7 +231,6 @@ def test_historical_prices_by_epic_and_date_range_v1_happy(self):
responses.add(
responses.GET,
re.compile("https://demo-api.ig.com/gateway/deal/prices/.+"),
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json=response_body,
status=200,
Expand Down Expand Up @@ -273,7 +268,6 @@ def test_historical_prices_by_epic_and_date_range_happy(self):
responses.add(
responses.GET,
re.compile("https://demo-api.ig.com/gateway/deal/prices/.+"),
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json=response_body,
status=200,
Expand Down Expand Up @@ -376,7 +370,6 @@ def test_historical_prices_by_epic_and_num_points_happy(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP/DAY/10",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json=response_body,
status=200,
Expand Down Expand Up @@ -426,7 +419,6 @@ def test_historical_prices_by_epic_and_num_points_bad_numpoints(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json={
"errorCode": "Unable to convert value=3.14159 to type= Integer int"
Expand All @@ -448,7 +440,6 @@ def test_historical_prices_by_epic_and_num_points_bad_resolution(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json={},
status=200,
Expand Down
4 changes: 0 additions & 4 deletions tests/test_historical_prices_flat.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def test_historical_prices_v3_datetime_happy(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json=response_body,
status=200,
Expand Down Expand Up @@ -97,7 +96,6 @@ def test_historical_prices_v3_num_points_happy(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json=response_body,
status=200,
Expand Down Expand Up @@ -131,7 +129,6 @@ def test_historical_prices_v3_num_points_bad_numpoints(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json={
"errorCode": "Unable to convert value=3.14159 to type= Integer int"
Expand Down Expand Up @@ -159,7 +156,6 @@ def test_historical_prices_v3_num_points_bad_resolution(self):
responses.add(
responses.GET,
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
match_querystring=False,
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
json=response_body,
status=200,
Expand Down
9 changes: 6 additions & 3 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def ig_service(request, retrying):
ig_service.logout()


# TODO refactor for new navigation API
@pytest.fixture()
def top_level_nodes(ig_service: IGService):
"""test fixture gets the top level navigation nodes"""
Expand Down Expand Up @@ -270,6 +271,7 @@ def test_create_session_bad_api_key(self, retrying):
with pytest.raises(IGException):
ig_service.create_session()

@pytest.mark.xfail(reason="Navigation API has been changed by IG")
def test_fetch_top_level_navigation_nodes(self, top_level_nodes):
assert isinstance(top_level_nodes, pd.DataFrame)

Expand Down Expand Up @@ -402,6 +404,7 @@ def assert_sentiment(response):
assert isinstance(short, float)
assert long + short == 100.0

@pytest.mark.xfail(reason="Navigation API has been changed by IG")
def test_fetch_sub_nodes_by_node(self, ig_service: IGService, top_level_nodes):
rand_index = randint(0, len(top_level_nodes) - 1)
response = ig_service.fetch_sub_nodes_by_node(rand_index)
Expand Down Expand Up @@ -460,7 +463,7 @@ def test_search_markets(self, ig_service: IGService):

def test_fetch_historical_prices_by_epic_and_numpoints(self, ig_service: IGService):
response = ig_service.fetch_historical_prices_by_epic_and_num_points(
"CS.D.EURUSD.MINI.IP", "H", 4
"CS.D.EURUSD.MINI.IP", "h", 4
)
assert isinstance(response["allowance"], dict)
assert isinstance(response["prices"], pd.DataFrame)
Expand All @@ -470,7 +473,7 @@ def test_fetch_historical_prices_by_epic_and_numpoints_flat(
self, ig_service: IGService
):
response = ig_service.fetch_historical_prices_by_epic_and_num_points(
"CS.D.EURUSD.MINI.IP", "H", 4, format=ig_service.flat_prices
"CS.D.EURUSD.MINI.IP", "h", 4, format=ig_service.flat_prices
)
assert isinstance(response["allowance"], dict)
assert isinstance(response["prices"], pd.DataFrame)
Expand All @@ -481,7 +484,7 @@ def test_fetch_historical_prices_by_epic_and_numpoints_mid(
self, ig_service: IGService
):
response = ig_service.fetch_historical_prices_by_epic_and_num_points(
"CS.D.EURUSD.MINI.IP", "H", 4, format=ig_service.mid_prices
"CS.D.EURUSD.MINI.IP", "h", 4, format=ig_service.mid_prices
)
assert isinstance(response["allowance"], dict)
assert isinstance(response["prices"], pd.DataFrame)
Expand Down