File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -416,6 +416,39 @@ public List<Position> GetPendingOrders()
416
416
417
417
}
418
418
419
+ /// <summary>
420
+ /// Get Information from an opened order
421
+ /// </summary>
422
+ /// <returns>Opened order</returns>
423
+ public Position getOrderInfo ( long ticket )
424
+ {
425
+ try
426
+ {
427
+ JObject json_cmd = new JObject ( ) ;
428
+ json_cmd [ "MSG" ] = "ORDER_INFO" ;
429
+ json_cmd [ "TICKET" ] = ticket ;
430
+ JObject res = SendCommand ( json_cmd ) ;
431
+
432
+ if ( res [ "ERROR_ID" ] . ToString ( ) == "0" )
433
+ {
434
+ List < Position > opened = JsonConvert . DeserializeObject < List < Position > > ( res [ "OPENED" ] . ToString ( ) ) ;
435
+ if ( opened . Count > 0 )
436
+ {
437
+ return opened . First ( ) ;
438
+ }
439
+ else return new Position ( ) ;
440
+ }
441
+ else
442
+ {
443
+ throw new Exception ( "Error with the GetOpenedOrders command. ERROR_ID: " + res [ "ERROR_ID" ] + " ERROR_DESCRIPTION: " + res [ "ERROR_DESCRIPTION" ] ) ;
444
+ }
445
+ }
446
+ catch ( Exception )
447
+ {
448
+ throw ;
449
+ }
450
+ }
451
+
419
452
/// <summary>
420
453
/// Get Opened Positions
421
454
/// </summary>
You can’t perform that action at this time.
0 commit comments