Skip to content

Commit d3774e7

Browse files
Merge pull request #366 from bug-or-feature/navigation-api-changes
Navigation API changes
2 parents 0513629 + a1fba77 commit d3774e7

4 files changed

Lines changed: 7 additions & 17 deletions

File tree

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
16+
python-version: [ "3.10", "3.11", "3.12" ]
1717

1818
steps:
1919

tests/test_historical_prices.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def test_historical_prices_v3_datetime_happy(self):
5353
responses.add(
5454
responses.GET,
5555
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
56-
match_querystring=False,
5756
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
5857
json=response_body,
5958
status=200,
@@ -95,7 +94,6 @@ def test_historical_prices_v3_num_points_happy(self):
9594
responses.add(
9695
responses.GET,
9796
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
98-
match_querystring=False,
9997
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
10098
json=response_body,
10199
status=200,
@@ -126,7 +124,6 @@ def test_historical_prices_v3_num_points_bad_numpoints(self):
126124
responses.add(
127125
responses.GET,
128126
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
129-
match_querystring=False,
130127
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
131128
json={
132129
"errorCode": "Unable to convert value=3.14159 to type= Integer int"
@@ -151,7 +148,6 @@ def test_historical_prices_v3_num_points_bad_resolution(self):
151148
responses.add(
152149
responses.GET,
153150
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
154-
match_querystring=False,
155151
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
156152
json=response_body,
157153
status=200,
@@ -235,7 +231,6 @@ def test_historical_prices_by_epic_and_date_range_v1_happy(self):
235231
responses.add(
236232
responses.GET,
237233
re.compile("https://demo-api.ig.com/gateway/deal/prices/.+"),
238-
match_querystring=False,
239234
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
240235
json=response_body,
241236
status=200,
@@ -273,7 +268,6 @@ def test_historical_prices_by_epic_and_date_range_happy(self):
273268
responses.add(
274269
responses.GET,
275270
re.compile("https://demo-api.ig.com/gateway/deal/prices/.+"),
276-
match_querystring=False,
277271
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
278272
json=response_body,
279273
status=200,
@@ -376,7 +370,6 @@ def test_historical_prices_by_epic_and_num_points_happy(self):
376370
responses.add(
377371
responses.GET,
378372
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP/DAY/10",
379-
match_querystring=False,
380373
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
381374
json=response_body,
382375
status=200,
@@ -426,7 +419,6 @@ def test_historical_prices_by_epic_and_num_points_bad_numpoints(self):
426419
responses.add(
427420
responses.GET,
428421
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
429-
match_querystring=False,
430422
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
431423
json={
432424
"errorCode": "Unable to convert value=3.14159 to type= Integer int"
@@ -448,7 +440,6 @@ def test_historical_prices_by_epic_and_num_points_bad_resolution(self):
448440
responses.add(
449441
responses.GET,
450442
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
451-
match_querystring=False,
452443
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
453444
json={},
454445
status=200,

tests/test_historical_prices_flat.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def test_historical_prices_v3_datetime_happy(self):
5454
responses.add(
5555
responses.GET,
5656
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
57-
match_querystring=False,
5857
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
5958
json=response_body,
6059
status=200,
@@ -97,7 +96,6 @@ def test_historical_prices_v3_num_points_happy(self):
9796
responses.add(
9897
responses.GET,
9998
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
100-
match_querystring=False,
10199
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
102100
json=response_body,
103101
status=200,
@@ -131,7 +129,6 @@ def test_historical_prices_v3_num_points_bad_numpoints(self):
131129
responses.add(
132130
responses.GET,
133131
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
134-
match_querystring=False,
135132
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
136133
json={
137134
"errorCode": "Unable to convert value=3.14159 to type= Integer int"
@@ -159,7 +156,6 @@ def test_historical_prices_v3_num_points_bad_resolution(self):
159156
responses.add(
160157
responses.GET,
161158
"https://demo-api.ig.com/gateway/deal/prices/MT.D.GC.Month2.IP",
162-
match_querystring=False,
163159
headers={"CST": "abc123", "X-SECURITY-TOKEN": "xyz987"},
164160
json=response_body,
165161
status=200,

tests/test_integration.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def ig_service(request, retrying):
8181
ig_service.logout()
8282

8383

84+
# TODO refactor for new navigation API
8485
@pytest.fixture()
8586
def top_level_nodes(ig_service: IGService):
8687
"""test fixture gets the top level navigation nodes"""
@@ -270,6 +271,7 @@ def test_create_session_bad_api_key(self, retrying):
270271
with pytest.raises(IGException):
271272
ig_service.create_session()
272273

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

@@ -402,6 +404,7 @@ def assert_sentiment(response):
402404
assert isinstance(short, float)
403405
assert long + short == 100.0
404406

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

461464
def test_fetch_historical_prices_by_epic_and_numpoints(self, ig_service: IGService):
462465
response = ig_service.fetch_historical_prices_by_epic_and_num_points(
463-
"CS.D.EURUSD.MINI.IP", "H", 4
466+
"CS.D.EURUSD.MINI.IP", "h", 4
464467
)
465468
assert isinstance(response["allowance"], dict)
466469
assert isinstance(response["prices"], pd.DataFrame)
@@ -470,7 +473,7 @@ def test_fetch_historical_prices_by_epic_and_numpoints_flat(
470473
self, ig_service: IGService
471474
):
472475
response = ig_service.fetch_historical_prices_by_epic_and_num_points(
473-
"CS.D.EURUSD.MINI.IP", "H", 4, format=ig_service.flat_prices
476+
"CS.D.EURUSD.MINI.IP", "h", 4, format=ig_service.flat_prices
474477
)
475478
assert isinstance(response["allowance"], dict)
476479
assert isinstance(response["prices"], pd.DataFrame)
@@ -481,7 +484,7 @@ def test_fetch_historical_prices_by_epic_and_numpoints_mid(
481484
self, ig_service: IGService
482485
):
483486
response = ig_service.fetch_historical_prices_by_epic_and_num_points(
484-
"CS.D.EURUSD.MINI.IP", "H", 4, format=ig_service.mid_prices
487+
"CS.D.EURUSD.MINI.IP", "h", 4, format=ig_service.mid_prices
485488
)
486489
assert isinstance(response["allowance"], dict)
487490
assert isinstance(response["prices"], pd.DataFrame)

0 commit comments

Comments
 (0)