Skip to content

IGS streamer help, need help with a little code #295

Closed Answered by LordNadimi
LordNadimi asked this question in Q&A
Discussion options

You must be logged in to vote

Took me some time, but I managed to crack this one as well! Learning by trying (again and again)!! For anyone else ever needing some assistance here is the code

from trading_ig import IGService, IGStreamService
from trading_ig.config import config
from trading_ig.lightstreamer import Subscription
import json

def handle_trades_update(trades_update):
    if trades_update["name"] == "TRADE:" + config.acc_number:
        opu_data = trades_update["values"]["OPU"]
    if opu_data is not None:
        opu_data = json.loads(opu_data)
        deal_id = opu_data["dealId"]
        current_trade_status = opu_data["status"]
        current_trade_direction = opu_data["direction"]
        
# subscribe …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by LordNadimi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant