Jump to content

Amruta

Members
  • Content count

    15
  • Joined

  • Last visited

Posts posted by Amruta


  1. Hi!

    I have a demo account on Forex.com. I am doing POST request to Login API call with request body: 

    request_body = {
        "UserName": self.username,
        "Password": self.password,
        "AppVersion": "1",
        "AppComments": "",
        "AppKey": self.app_key
    }

    Here even if I do not provide any AppKey, or if I give AppKey = blank string "", still this request works and I get the Session Id in response.

    I would like to know, when do we need the AppKey then?

     


  2. I read through this thread and got a lot of useful info. So, with demo account I'm making NewTradeOrder Api call to close an open position. In the request body I am giving OfferPrice and BidPrice both the same value = Mid Price. And my trade request is successful. Is it correct to do so?  Honestly speaking, I'm finding using LS with Python hard to use so currently not reading prices from Lightstreamer. I'm using GetPriceTicks's latest MID price tick as the current price.


  3. Hello! I currently have a Demo account on Forex.com. Is there an option to have 2FA enabled while Sign-up for a real and demo account? Can enable 2FA later? Are there API calls to handle 2FA?

    Another question: Can I still use ValidateSession API call to validate the current session ID, before making any further api calls? I am asking this because I understood that ValidateSesion will be deprecated soon. 

    Thanks!

     


  4. Hello, After logon API call, I am getting a Session ID which I am using for all subsequent API calls. I would like to know for long is this session valid? I tried using ValidateSession API. It is giving False response even for working Session Id. Document says : this API call response is for the use of the CI Connect social trading platform.


  5. I am using this python code to place a new trade order:

    import requests
    import json

    SESSION = '3caf1b25-1d77-4bb2-bbf0-xxxxxxxxxxx'
    SESSION_BUNDLE = '&Session='+SESSION+'&UserName=xxxxxxxxx'

    null = None
    false = False
    true = True
    bodyPlace = {"OcoOrder":null,
            "Type":null,
            "LastChangedDateTimeUTCDate":null,
            "ExpiryDateTimeUTC":null,
            "Applicability":null,
            "Direction":"buy",
            "ExpiryDateTimeUTCDate":null,
            "TriggerPrice":null,
            "BidPrice":1.4395,
            "AuditId":"8049808-0-0-0-R",
            "AutoRollover":false,
            "MarketId":401484392,
            "isTrade":true,
            "OfferPrice":1.4397,
            "OrderId":null,
            "LastChangedDateTimeUTC":null,
            "Currency":null,
            "Quantity":1,
            "QuoteId":null,
            "TradingAccountId":xxxxxxxxxxx,
            "MarketName":"GBP/USD",
            "PositionMethodId":1,
            "Status":null,
            "IfDone":[]}


    r = requests.post('https://ciapi.cityindex.com/TradingAPI/order/newtradeorder?'+SESSION_BUNDLE, json = bodyPlace)
     

    And getting the following response:

    <Response [200]>
    {'Status': 2, 'StatusReason': 75, 'OrderId': 0, 'Orders': [{'OrderId': 0, 'StatusReason': 81, 'Status': 10, 'OrderTypeId': 1, 'Price': 0.0, 'Quantity': 1.0, 'TriggerPrice': 0.0, 'CommissionCharge': 0.0, 'IfDone': [], 'GuaranteedPremium': 0.0, 'OCO': None, 'AssociatedOrders': {'Stop': None, 'Limit': None}, 'Associated': False}], 'Quote': None, 'Actions': [], 'ErrorMessage': None}

     

    Could you help me understand where I am going wrong?

     

×