-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproblems.txt
51 lines (40 loc) · 1.58 KB
/
problems.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Error: Used incorrect epic for S&P 500
Fix:
from trading_ig import IGService
import pandas as pd
# Initialize IGService
username = "davidvorster_ig_demo"
password = "OPGEST44n"
api_key = "a51cf907e8a52d08f68fc1d452f87dbef61927fe"
ig_service = IGService(username, password, api_key, acc_type="DEMO")
# Log in
ig_service.create_session()
# Search for the S&P 500 epic
search_results = ig_service.search_markets("S&P")
# Print results to inspect the structure
print(search_results)
# Handle different structures
try:
for index, row in search_results.iterrows(): # If it's a DataFrame
print(f"Epic: {row['epic']}, Name: {row['instrumentName']}")
except KeyError:
print("KeyError: The DataFrame does not have the expected keys.")
except AttributeError:
print("The search results are not a DataFrame or iterable.")
Error: Configuration not working
Fix: Seperate file for configuration
class config(object):
username = "davidvorster_ig_demo"
password = "OPGEST44n"
api_key = "a51cf907e8a52d08f68fc1d452f87dbef61927fe"
acc_type = "DEMO"
acc_number = "X7L6G"
Error: Dates not working
Fix: Dates needed with time included
Problem: Hard to manage Pandas dataframe
Fix: Had to examine the docs and use trial and error
Problem: Ignored NaN, Inf, or -Inf value.
Attempting to set invalid range for value axis: [ nan - nan ]
Fix: Max price and min price wrong way round, switched
Client feedback: Times only shown at XX:15 and XX:45, should be shown at half hour intervals
Response: Added more padding to ensure correct times shown