Jump to content

Physicsman

Administrators
  • Content count

    738
  • Joined

  • Last visited

  • Days Won

    18

Reputation Activity

  1. Thanks
    Physicsman got a reaction from SupereeDuperee in Best way to know if Market is closed   
    Hi Superee,
    It is the MarketPrcingTimes fields. Since these are Forex 24H trading markets, we've been using a shortcut internally and that is probably what is causing you confusion. 
    DayofWeek 0 is Sunday and DayofWeek 5 is Friday. Since we know that FX markets open on Sunday and close on Friday, we just take the current week's Sunday and Friday dates. The actual Date returned in the field is just today's date and close time of 22:00 hours. We're ignoring the date and appending the 22:00 hours close/open times to the Sunday Start and Friday End dates to get each weeks open/close. 
    Kind Regards, PM

  2. Like
    Physicsman got a reaction from SupereeDuperee in NewTradeOrderRequestDTO Properties Doesn't match Examples   
    Hi Superee,
    Check the OrderStatusReason code that is also included in the response. It provides more information on the error and its cause.
    Kind Regards, PM
  3. Thanks
    Physicsman reacted to SupereeDuperee in Cannot Close Open Position (Consisting Multiple Orders ) Quantity value in 100's or 10's, like 75,120   
    Thanks for the detailed information. I will send CLOSE request with PriceTolerance value "2" so that most of the time close order would go through.
  4. Thanks
    Physicsman reacted to SupereeDuperee in API End Point UserAccount/ClientAndTradingAccount DOWN ?   
    Yes, it was DEMO Account. The outage was intermittent on Friday. Working fine this week. Thanks for checking.
  5. Thanks
    Physicsman reacted to SupereeDuperee in Attached Limit Order for New Trade fails in Live Account   
    Ok, I should've guessed the "Inheritance" - may be I missed that to remember when studied the documentation. Thanks for pointing that out.
    I assume anytime I see something like :-
    ApiPrimaryMarketTagDTO > ApiMarketTagDTO I know "ApiPrimaryMarketTagDTO" class inherits from "ApiMarketTagDTO" class (in c# terms)
    Thanks for the info!
  6. Thanks
    Physicsman got a reaction from SupereeDuperee in Attached Limit Order for New Trade fails in Live Account   
    Hi Superee,
    ApiStopLimitOrderDTO also inherits from ApiOrderDTO and all of its properties, hence the link to that DTO in the documentation. Additionally, many of the Properties are nullable and can be dropped from the reqeusts. 

     
    A valid trade request with attached stops/limits can be formed as in the following example:
    "IfDone": [ { "Stop": { "OrderId": 778252070, "StatusReason": 1, "Status": 2, "OrderTypeId": 2, "Price": 0, "Quantity": 1000, "TriggerPrice": 1.36261, "CommissionCharge": 0, "IfDone": [], "GuaranteedPremium": 0, "OCO": null, "AssociatedOrders": { "Stop": null, "Limit": null }, "Associated": false }, "Limit": { "OrderId": 778252069, "StatusReason": 1, "Status": 2, "OrderTypeId": 3, "Price": 0, "Quantity": 1000, "TriggerPrice": 1.36661, "CommissionCharge": 0, "IfDone": [], "GuaranteedPremium": 0, "OCO": null, "AssociatedOrders": { "Stop": null, "Limit": null }, "Associated": false } } ], Kind Regards, PM
     
  7. Like
    Physicsman got a reaction from SupereeDuperee in Is the API Documentation site down?   
    Hello,
    You may temporarily use the address: https://platformapidocs.svc.cityindex.com/ to access the online documentation. This will be mapped to http://docs.labs.gaincapital.com/ soon, which remains it's permanent address.
    Kind Regards, PM
  8. Thanks
    Physicsman reacted to SirNewton in Realtime streaming data for pairs or symbols   
    Thanks Superee. Even though, I wrote my code in Python, your code was a good reference on what to do in the subscription.
    I successfully wrote everything in Python, but looking at the demo code given by Lightstreamer, I noticed that the error handling was pretty lacking.
    Those that are doing their code in Python, I suggest you do something like below:
        subscription.addlistener(on_item_update) # Adding the "on_item_update" function to Subscription    
        sub_key = lightstreamer_client.subscribe(subscription) # Registering the Subscription
        try:
            wait_for_input()        
            lightstreamer_client.unsubscribe(sub_key) # Unsubscribing from Lightstreamer by using the subscription key        
            lightstreamer_client.disconnect() # Disconnecting Lightstreamer      
            kafka_producer_obj.close()  # Close Apache Kafka
        except KeyboardInterrupt:
            lightstreamer_client.unsubscribe(sub_key)
            lightstreamer_client.disconnect()
            kafka_producer_obj.close()
            print('Manual break by user')
        except Exception as e:
            lightstreamer_client.unsubscribe(sub_key)
            lightstreamer_client.disconnect()
            kafka_producer_obj.close()
            print(e)
    You can ignore the "kafka_producer_obj.close()". I have that because, I also use Kafka and need to close the connection on that too.
     
  9. Thanks
    Physicsman reacted to SirNewton in Realtime streaming data for pairs or symbols   
    In the demo: https://github.com/Lightstreamer/Lightstreamer-example-StockList-client-python/blob/master/src/stock_list_demo.py
    I would also suggest changing:
    def wait_for_input():
    input("{0:-^80}\n".format("HIT CR TO UNSUBSCRIBE AND DISCONNECT FROM \
    LIGHTSTREAMER"))
    To something like this:
        def wait_for_input():
            while True: 
                try:
                    q = input("{0:-^80}\n".format("Press q than Enter to Unsubscribe and Disconnect from Lightstreamer"))
                    if q == 'q': break
                except: break
    With the way it was written originally anytime you hit Enter it would exit. This way you can press 'q' than Enter to exit. Better control.
  10. Thanks
    Physicsman reacted to SupereeDuperee in Realtime streaming data for pairs or symbols   
    I hope this link works. Visual Studio 2017/19 Solution Folder Ziipped .
    https://drive.google.com/file/d/1SavnJe6f_NRFE5-LYV9arewd893d7AdP/view?usp=sharing
    I created a Class to hold the rate info, and a List of that Rate Info Class - which keeps latest rate info , along with showing rates on the screen.
  11. Thanks
    Physicsman reacted to SupereeDuperee in C# .NET NewtonSoft JSON Deserializing ListOpenPositionsResponseDTO   
    Aaah Dang It! It was my Coding Error, in the "public class ApiOpenPositionDTO" I had 
            public List<ApiAssociatedDTO> AssociatedOrders { get; set; }
     
    but CORRECT Format IS = 
            public ApiAssociatedDTO AssociatedOrders { get; set; }
     
    Now it is DeSerializing just fine.
    ********* THIS THREAD /POST Can Be deleted as I found My Answer Myself But can be kept for Future Users ******
  12. Thanks
    Physicsman reacted to SirNewton in List of pairs corresponding to the numbers   
    Thank you Physicsman. In python, I was doing below for conversion:
    from datetime import datetime
    dateconv = datetime.fromtimestamp(1611273600000 / 1e3)
    print(dateconv)
    I should have been doing:
    from datetime import datetime
    dateconv = datetime.utcfromtimestamp(1611273600000 / 1e3)
    print(dateconv)
  13. Thanks
    Physicsman reacted to wertmandu in Order Status Reason 81   
    I will check to see the code is in fact grabbing the quantity correctly, however I believe that I have not made any changes in that respect for creating the json to send. On the other hand I have only just recently began testing with quantities larger than 1000. I will report back if it is an error with my code attempting to send incorrect information. 
  14. Thanks
    Physicsman reacted to motown69 in Error Code in Live Account   
    Perfect....
    Yes that's what it was.... I didn't realise the Market IDs in the Live account were different to the Demo account.
    This now Works.
    Thanks for your help...:)
  15. Thanks
    Physicsman reacted to SupereeDuperee in Demo Account Access Denied   
    Just sent you a private message.
  16. Thanks
    Physicsman got a reaction from chriss in Aggregating Historical Trades Via ApiTradeHistoryDTO   
    Hi Chris,
    The task is currently scheduled in the Sprint for the period 20th Oct through 2nd Nov.
    Kind Regards, PM
  17. Thanks
    Physicsman reacted to Chuck in Json format   
    I apologize for my not being more thorough in my debugging.  I thought that I was looking at the raw response, but in fact I was looking at a string which had been corrupted by my own code.  Thank you for taking the time to look into this.
  18. Thanks
    Physicsman reacted to Sudhir Tambe in New Limit order creation giving error status 15   
    Thanks for your help.
    triggerPrice field was missing.
    It worked after adding this field.
  19. Like
    Physicsman got a reaction from u1035 in List of Currency IDs   
    Hello u1035,
    The table of currency codes is pasted below.
    Kind Regards, PM
     
    CurrencyId ISOCurrency Description 1 AUD Australian Dollar 2 CAD Canadian Dollar 3 CHF Swiss Franc 4 EUR Currency of EMU member states 6 GBP British Pound 7 HKD Hong Kong Dollar 8 JPY Japanese Yen 9 SEK Swedish Krona 10 SGD Singapore Dollar 11 USD American Dollar 12 ZAR South African Rand 14 DKK Danish Krone 15 IDR Indonesian Rupiah 16 KRW Korean Won 17 MXN Mexican Peso 18 MYR Malaysian Ringgit 19 NOK Norwegian Kroner 20 NZD New Zealand Dollar 21 THB Thai Bhat 22 TWD Taiwanese Dollar 23 INR Indian Rupee 24 PLN Polish Zloty 31 TRY Turkish Lira 32 CZK Czech Kroner 33 HUF Hungarian Forint 34 SKK Slovakian Kroner 36 CNH Chinese Yuan 37 AED Emirati Dirham 38 BRL Brazilian Real 39 ILS Israeli Shekel 40 RON Romanian Leu 41 RUB Russian Ruble 42 SAR Saudi Riyal 43 XAU Gold 44 XAG Silver 45 CNY Chinese Yuan Renminbi 46 BTC Bitcoin 47 ETH Ethereum 48 BCH Bitcoin Cash 49 LTC Litecoin 50 XRP Ripple
  20. Thanks
    Physicsman got a reaction from Ynor in Set Stop/Limit to a new trade   
    Hi Rony,
    Yes, mainly removing the TriggerPrice field. The list of permissable fields for a market order (trade) request is detailed at http://docs.labs.gaincapital.com/#Data Types/NewTradeOrderRequestDTO.htm. I've pasted an example below.
    Yes, US clients can send a market order (trade) request with attached stops and limits as I have done in the example below.
    Kind Regards, PM
    { "MarketId": 400723798, "Direction": "buy", "Quantity": 1000, "BidPrice": 106.174, "OfferPrice": 106.204, "AuditId": "ELU17236432", "TradingAccountId": 401843563, "PositionMethodId": 1, "IfDone": [ { "Stop": { "OrderId": null, "Direction": "sell", "Applicability": "gtc", "ExpiryDateTimeUTC": null, "Guaranteed": false, "TrailingDistance": 10, "Quantity": 1000, "TriggerPrice": null, "IfDone": [], "OcoOrder": null }, "Limit": { "OrderId": null, "Direction": "sell", "Applicability": "gtc", "ExpiryDateTimeUTC": null, "Quantity": 1000, "TriggerPrice": 106.704, "IfDone": [], "OcoOrder": null } } ], "Reference": "Origin601" }  
  21. Like
    Physicsman reacted to Ynor in .Net C# Lightstreamer Demo   
    For future reference:
    1. First, download the proper Lightstreamer client demo:
    https://github.com/Lightstreamer/Lightstreamer-example-Quickstart-client-dotnet/tree/for_version_4
    2. Download the following nuget packages :

    Some things to note:
    Make sure the version for Lightstreamer client is 4.0.0 (this is the only version that the Forex Servers are currently working with). In this demo I am using the latest logging service (NLog 4.7.4) -- this is the one that Lightstreamer is currently using in their version 5+ demos. You will need to make sure your Wrapper class is also the latest version.  This works with .NET Core 3.0 and previous .net framework versions. 3. Setup your client and subscription.
    This is the C# code to setup and connect to the Prices streaming server:

     
    Regards,
     
    Rony
     
     
     
     
  22. Thanks
    Physicsman reacted to chriss in Aggregating Historical Trades Via ApiTradeHistoryDTO   
    Hi PM
    I did supply the TradingAccountID parameter. The C# code is:
    string requestString = serverBaseURL + string.Format("/order/tradehistory?TradingAccountId={0}&maxResults=500&from={1}", tradingAccountId, unixTimestamp);
    Kind Regards
    Chris.
  23. Thanks
    Physicsman got a reaction from jflaggs in Aggregating Historical Trades Via ApiTradeHistoryDTO   
    Update: the team have created an internal ticket to track this investigation. Since I have the ticket number I can keep an eye on its progress and update here when I see a status change. 
  24. Like
    Physicsman got a reaction from jflaggs in Aggregating Historical Trades Via ApiTradeHistoryDTO   
    Hi,
    Apologies for the long delay - it should not have taken that long to receive a response. It looks as though the responding agent did not understand the query correctly, and is indeed asking you to use the Web platform to view the full account information. 
    I'm sending you a private message with some contact information to progress this query further.
    Kind Regards. PM
  25. Like
    Physicsman got a reaction from garrettkolson in ApiMarketInformationDTO MarginFactor   
    Hi Garret,
    Apologies for the confusion.
    Many of our markets such as these popular GBP and JPY markets are setup tor Step Margin, which is banded depending upon position size. This means it is the StepMargin part of the ApiMarketInformationDTO that should be examined for the Margin information. The response looks similar to the screenshot below, which mirrors how it is shown on the Web platform.

     

     
    Kind Regards, PM
     
×