@@ -945,6 +945,44 @@ public bool TrackPrices(List<string> symbols)
945945 }
946946 }
947947
948+ /// <summary>
949+ /// Start streaming prices from a list of symbols
950+ /// </summary>
951+ /// <param name="symbols">Asset List</param>
952+ /// <returns>True if the command was executed successfully. Streaming data will be received on the data port</returns>
953+ /// <exception cref="Exception"></exception>
954+ public bool TrackPrices ( List < Asset > symbols )
955+ {
956+ try
957+ {
958+ JObject json_cmd = new JObject ( ) ;
959+ json_cmd [ "MSG" ] = "TRACK_PRICES" ;
960+
961+ symbols = symbols . Where ( x => x . TRADE_MODE > 0 ) . ToList ( ) ; //Avoid disabled symbols
962+
963+ JArray ja = new JArray ( ) ;
964+ foreach ( Asset symbol in symbols )
965+ ja . Add ( symbol . NAME ) ;
966+
967+ json_cmd [ "SYMBOLS" ] = ja ;
968+
969+ JObject res = SendCommand ( json_cmd ) ;
970+
971+ if ( res [ "ERROR_ID" ] . ToString ( ) == "0" )
972+ {
973+ return true ;
974+ }
975+ else
976+ {
977+ throw new Exception ( "Error with the command sent. ERROR_ID: " + res [ "ERROR_ID" ] + " ERROR_DESCRIPTION: " + res [ "ERROR_DESCRIPTION" ] ) ;
978+ }
979+ }
980+ catch ( Exception )
981+ {
982+ throw ;
983+ }
984+ }
985+
948986 /// <summary>
949987 /// Start streaming OHLC data from a list of symbols
950988 /// </summary>
@@ -983,6 +1021,47 @@ public bool TrackOHLC(List<string> symbols, TimeFrame tf)
9831021 }
9841022 }
9851023
1024+ /// <summary>
1025+ /// Start streaming OHLC data from a list of symbols
1026+ /// </summary>
1027+ /// <param name="symbols">Asset list</param>
1028+ /// <param name="tf">TimeFrame</param>
1029+ /// <returns>True if the command was executed successfully</returns>
1030+ /// <exception cref="Exception"></exception>
1031+ public bool TrackOHLC ( List < Asset > symbols , TimeFrame tf )
1032+ {
1033+ try
1034+ {
1035+ JObject json_cmd = new JObject ( ) ;
1036+ json_cmd [ "MSG" ] = "TRACK_OHLC" ;
1037+ json_cmd [ "TIMEFRAME" ] = tf . ToString ( ) ;
1038+
1039+ JArray ja = new JArray ( ) ;
1040+
1041+ symbols = symbols . Where ( x => x . TRADE_MODE > 0 ) . ToList ( ) ;
1042+
1043+ foreach ( Asset symbol in symbols )
1044+ ja . Add ( symbol . NAME ) ;
1045+
1046+ json_cmd [ "SYMBOLS" ] = ja ;
1047+
1048+ JObject res = SendCommand ( json_cmd ) ;
1049+
1050+ if ( res [ "ERROR_ID" ] . ToString ( ) == "0" )
1051+ {
1052+ return true ;
1053+ }
1054+ else
1055+ {
1056+ throw new Exception ( "Error with the command sent. ERROR_ID: " + res [ "ERROR_ID" ] + " ERROR_DESCRIPTION: " + res [ "ERROR_DESCRIPTION" ] ) ;
1057+ }
1058+ }
1059+ catch ( Exception )
1060+ {
1061+ throw ;
1062+ }
1063+ }
1064+
9861065 /// <summary>
9871066 /// Start streaming order events
9881067 /// </summary>
0 commit comments