Jump to content

SupereeDuperee

Members
  • Content count

    37
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by SupereeDuperee

  1. OK, Sigh of Relief! On LIVE account the Margin Required Amount API Call returns RIGHT Value = 1369.xx. So we should be good in real life scenario.
  2. Also DO NOT USE the Pre-Prod URL - that has been deprecated. Use the LIVE Url for both DEMO and Live accounts.
  3. I am trying to get Margin Required amount for GBP/JPY, 20000 Quantity. I call POST on this URL https://ciapi.cityindex.com/TradingAPI/order/simulate/newtradeorder?UserName=demo210127&Session= The Request JSON is { "MarketId":401484385, "Currency":null, "AutoRollover":false, "Direction":"Buy", "Quantity":20000.0, "QuoteId":0, "PositionMethodId":1, "BidPrice":1.0001, "OfferPrice":999.9999, "AuditId":"1739236", "TradingAccountId":101295826, "IfDone":null, "Close":null, "Reference":null, "AllocationProfileId":0, "OrderReference":null, "Source":null, "PriceTolerance":0 } The Response JSON is:- { "Status": 1, "StatusReason": 1, "SimulatedCash": 49991.82, "ActualCash": 49991.82, "SimulatedTotalMarginRequirement": 2648.42, "ActualTotalMarginRequirement": 1280.36, "CurrencyId": 11, "Orders": [ { "StatusReason": 1, "Status": 3 } ] } From the documentation, if I am not wrong, "SimulatedTotalMarginRequirement": 2648.42, is the REQUIRED MARGIN Amount. I am using my DEMO account. However if I try to place a NEW TRADE ORDER from the WebTrader website, using the same DEMO account I get required margin amount = 1369.10. Screenshot attached. Why the margin requirement amount is not SAME from WebTrader and API call?
  4. I have created a C# .NET Console app that collects streaming rates (and saves to database). If you are interested I can share my code.
  5. I kind of assumed that and found the API Call to Open a Market Trade works fine without the NEW FIELDS. However I found this really interesting :- The Bid/Offer value has ABSOLUTELY no EFFECT as long as they are 0<Bid<Offer and CurrentRate falls within Bid/Offer range. So I am using Bid=1.0001 and Offer=999.9999 in my OpentMarketTrade API calls and it buys/sells at the current rate. I am skipping an API call to get Current Bid/Ask values. Is there any Serious Risk using Bid=1.0001 and Offer=999.9999 values in above scenario? {"MarketId":401484406,"Currency":null,"AutoRollover":false, "Direction":"Buy","Quantity":3000.0,"QuoteId":0,"PositionMethodId":0, "BidPrice":1.0001,"OfferPrice":9.9999,"AuditId":"6123214", "TradingAccountId":101958216,"IfDone":null,"Close":null,"Reference":null, "AllocationProfileId":0,"OrderReference":null,"Source":null, "MarketName":"EUR/USD","PriceTolerance":0} Also, The "MarketName":"EUR/USD" is useless, in above JSON i used MarketId=401484406 Which is USD/CAD so the "MarketName" is useless.
  6. 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 ******
  7. After a successful GET call to "https://ciapi.cityindex.com/TradingAPI/order/openpositions?TradingAccountId=xxxx" I get the below response { "OpenPositions": [ { "OrderId": 776551478, "MarketId": 401484347, "MarketName": "EUR/USD", "Direction": "buy", "Quantity": 1000.0000, "Price": 1.212940000, "TradingAccountId": 403195826, "Currency": "USD", "Status": 3, "StopOrder": null, "LimitOrder": null, "LastChangedDateTimeUTC": "/Date(1611640457973)/", "CreatedDateTimeUTC": "/Date(1611640457972)/", "ExecutedDateTimeUTC": "/Date(1611640457972)/", "AutoRollover": false, "TradeReference": null, "ManagedTrades": [], "AllocationProfileId": 0, "AllocationProfileName": "", "AssociatedOrders": { "Stop": null, "Limit": null }, "FixedInitalMargin": 0.0, "PositionMethodId": 1 } ] } In my C# .NET App I am failing to convert the JSON text to Object, I am getting exception ListOpenPositionsResponseDTO listOpenPositions = JsonConvert.DeserializeObject<ListOpenPositionsResponseDTO>(JSON); Exception Error Message : I have attached the Classes files. Can any one please give me some ideas how to convert to .NET POC Object from JSON? OR Where I need to change? Exception message not much of a help pin-point the exact issue. ListOpenPositionsResponseDTO.cs ApiOpenPositionDTO.cs ApiAssociatedDTO.cs
  8. It's going to be a great PITA for that missing documentation URL. How difficult it is to put a landing HTML stating the documentation is under maintenance in the meantime download the PDF with the Link to the PDF? It's a 10 minute's job for any web developer / html coder - question is how Agile is your Web Development Team.
  9. .Net C# Lightstreamer Demo

    Hi, I have followed the instructions and could compile and (i believe) connect to the https://push.cityindex.com/ server. However I am getting Exception, this info showing up in Visual Studio 2019's OUTPUT window. Exception thrown: 'System.ArgumentException' in Lightstreamer_DotNet_Standard_Client.dll ===================== UPDATE ========================= I had to change the OnUpdae function in the TestTableListener.cs to match the FIELD NAMES, then the program worked fine. public void OnUpdate(int itemPos, string itemName, IUpdateInfo update) { Console.WriteLine(NotifyUpdate(update) + " for " + itemName + ":" + NotifyValue(update, "Bid") + NotifyValue(update, "Offer") + NotifyValue(update, "Direction")); }
  10. I am trying to get List of ApiMarketDTO for all 28 Major+Minor Forex Pairs. I am searching/calling "market/searchwithtags?TagId=" MarketTagId 80 to 89, 155,156, 147 etc. I get about 200 some pairs, but NZD/CAD is not one of them. I find that NZD/CAD has no MarketTagId that it falls under. Only way to get NZD/CAD marketid is calling "Market/Search?searchByMarketCode=TRUE&query=NZD%2FCAD& I do not understand all these MarketTagId segmentation, as a trader I need the list of all pairs. Anyway, Which MarketTagId will give me "NZD/CAD" pair when calling "market/searchwithtags"? Thank you.
  11. Demo Account Access Denied

    Well, in my case I can log in to the WebTrading using DEMO username/password, however cannot authenticate through API POST url = I get this result:- { "AdditionalInfo": null, "StatusCode": 2, "HttpStatus": 401, "ErrorMessage": "Sorry, your login has failed|This is because your login credentials do not match our records.", "ErrorCode": 4010 }
×