public IndicatorsMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.MenuTitle = "Indicators"; this.MenuDescription = "Displays list of indicators."; this.AdditionalOptions.Add(new MenuCommandListenersShow()); this.Refresh(); }
public UsersMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.MenuTitle = "Users"; this.MenuDescription = "Displays list of Covenant users."; this.AdditionalOptions.Add(new MenuCommandUsersShow(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandUsersCreate(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandUsersDelete(CovenantClient)); this.Refresh(); }
public HostedFilesMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter, Listener Listener) : base(CovenantClient, EventPrinter) { this.Listener = Listener; this.MenuTitle = "HostedFiles"; this.MenuDescription = "Files hosted by the HTTP Listener."; this.AdditionalOptions.Add(new MenuCommandHostedFilesShow(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandHostedFilesHost(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandHostedFilesRemove(CovenantClient)); this.SetupMenuAutoComplete(); }
public GruntsMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.MenuTitle = "Grunts"; this.MenuDescription = "Displays list of connected grunts."; this.MenuOptions.Add(new GruntInteractMenuItem(this.CovenantClient, this.EventPrinter)); this.AdditionalOptions.Add(new MenuCommandGruntsShow()); this.AdditionalOptions.Add(new MenuCommandGruntsRename(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandGruntsKill(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandGruntsHide(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandGruntsUnhide(CovenantClient)); this.SetupMenuAutoComplete(); }
public ListenersMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.MenuTitle = "Listeners"; this.MenuDescription = "Displays list of listeners."; this.MenuOptions.Add(new HTTPListenerMenuItem(this.CovenantClient, this.EventPrinter)); this.MenuOptions.Add(new ListenerInteractMenuItem(this.CovenantClient, this.EventPrinter)); this.AdditionalOptions.Add(new MenuCommandListenersShow()); this.AdditionalOptions.Add(new MenuCommandListenersRename(CovenantClient)); this.SetupMenuAutoComplete(); this.Refresh(); }
public HTTPListenerMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.httpListener = this.CovenantClient.ApiListenersHttpPost(new HttpListener()); this.httpProfile = this.CovenantClient.ApiListenersByIdProfileGet(this.httpListener.Id ?? default); this.listenerType = this.CovenantClient.ApiListenersTypesGet().FirstOrDefault(LT => LT.Name == "HTTP"); this.MenuTitle = listenerType.Name; this.MenuDescription = listenerType.Description; this.AdditionalOptions.Add(new MenuCommandHTTPListenerShow()); this.AdditionalOptions.Add(new MenuCommandHTTPListenerStart(this.CovenantClient, this.EventPrinter)); var setCommand = new MenuCommandHTTPListenerSet(this.CovenantClient); this.AdditionalOptions.Add(setCommand); this.AdditionalOptions.Add(new MenuCommandGenericUnset(setCommand.Parameters.FirstOrDefault(P => P.Name == "Option").Values)); this.Refresh(); }
public WscriptLauncherMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.wscriptLauncher = CovenantClient.ApiLaunchersWscriptGet(); this.MenuTitle = wscriptLauncher.Name; this.MenuDescription = wscriptLauncher.Description; this.AdditionalOptions.Add(new MenuCommandWscriptLauncherShow(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandWscriptLauncherGenerate(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandWscriptLauncherCode()); this.AdditionalOptions.Add(new MenuCommandWscriptLauncherHost(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandWscriptLauncherWriteFile()); var setCommand = new MenuCommandWscriptLauncherSet(CovenantClient); this.AdditionalOptions.Add(setCommand); this.AdditionalOptions.Add(new MenuCommandGenericUnset(setCommand.Parameters.FirstOrDefault(P => P.Name == "Option").Values)); this.Refresh(); }
public LaunchersMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.MenuTitle = "Launchers"; this.MenuDescription = "Displays list of launcher options."; this.MenuOptions.Add(new WmicLauncherMenuItem(this.CovenantClient, this.EventPrinter)); this.MenuOptions.Add(new Regsvr32LauncherMenuItem(this.CovenantClient, this.EventPrinter)); this.MenuOptions.Add(new MshtaLauncherMenuItem(this.CovenantClient, this.EventPrinter)); this.MenuOptions.Add(new CscriptLauncherMenuItem(this.CovenantClient, this.EventPrinter)); this.MenuOptions.Add(new WscriptLauncherMenuItem(this.CovenantClient, this.EventPrinter)); this.MenuOptions.Add(new InstallUtilLauncherMenuItem(this.CovenantClient, this.EventPrinter)); this.MenuOptions.Add(new MSBuildLauncherMenuItem(this.CovenantClient, this.EventPrinter)); this.MenuOptions.Add(new PowerShellLauncherMenuItem(this.CovenantClient, this.EventPrinter)); this.MenuOptions.Add(new BinaryLauncherMenuItem(this.CovenantClient, this.EventPrinter)); this.AdditionalOptions.Add(new MenuCommandLaunchersShow(this.CovenantClient)); this.SetupMenuAutoComplete(); }
public ListenerInteractMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.MenuTitle = "Interact"; this.MenuDescription = "Interact with a Listener."; this.MenuItemParameters = new List <MenuCommandParameter> { new MenuCommandParameter { Name = "Listener Name", Values = CovenantClient.ApiListenersGet().Select(L => new MenuCommandParameterValue { Value = L.Name }).ToList() } }; this.MenuOptions.Add(new HostedFilesMenuItem(this.CovenantClient, this.EventPrinter, listener)); this.AdditionalOptions.Add(new MenuCommandListenerInteractShow(this.CovenantClient)); this.AdditionalOptions.Add(new MenuCommandListenerInteractStart(this.CovenantClient, this.EventPrinter)); this.AdditionalOptions.Add(new MenuCommandListenerInteractStop(this.CovenantClient, this.EventPrinter)); this.SetupMenuAutoComplete(); }
public TaskMenuItem(CovenantAPI CovenantClient, EventPrinter EventPrinter, Grunt grunt) : base(CovenantClient, EventPrinter) { this.grunt = grunt; this.MenuTitle = "Task"; this.MenuDescription = "Task a Grunt to do something."; this.MenuItemParameters = new List <MenuCommandParameter> { new MenuCommandParameter { Name = "Task Name", Values = CovenantClient.ApiGruntTasksGet().Select(T => new MenuCommandParameterValue { Value = T.Name }).ToList() } }; this.AdditionalOptions.Add(new MenuCommandTaskShow(CovenantClient)); this.AdditionalOptions.Add(new MenuCommandTaskStart(CovenantClient)); var setCommand = new MenuCommandTaskSet(CovenantClient); this.AdditionalOptions.Add(setCommand); this.AdditionalOptions.Add(new MenuCommandGenericUnset(setCommand.Parameters.FirstOrDefault(P => P.Name == "Option").Values)); this.SetupMenuAutoComplete(); }
public MenuCommandHTTPListenerStart(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.Name = "Start"; this.Description = "Start the HTTP Listener"; this.Parameters = new List <MenuCommandParameter>(); }
static void Main(string[] args) { if (args.Length < 3 || args.Length > 13) { Console.WriteLine( "Usage: dxf_client <host:port> <event> <symbol> [<date>] [<source>] [snapshot] [-l <records_print_limit>] [-T <token>] [-s <subscr_data>] [-p]\n" + "where\n" + " host:port - The address of dxfeed server (demo.dxfeed.com:7300)\n" + " event - Any of the {Profile,Order,Quote,Trade,TimeAndSale,Summary,\n" + " TradeETH,SpreadOrder,Candle,Greeks,TheoPrice,Underlying,Series,\n" + " Configuration}\n" + " symbol - a) IBM, MSFT, ... ; * - all symbols\n" + " b) if it is Candle event you can specify candle symbol\n" + " attribute by string, for example: XBT/USD{=d}\n" + " date - The date of time series event in the format YYYY-MM-DD (optional)\n" + " source - Used only for Order or MarketMaker subscription:\n" + " a) OPTIONAL source for order events is any combination of:\n" + " NTV,NFX,ESPD,XNFI,ICE,ISE,DEA,DEX,BYX,BZX,BATE,CHIX,CEUX,\n" + " BXTR,IST,BI20,ABE,FAIR,GLBX,ERIS,XEUR,CFE,C2OX,SMFE...;\n" + " b) source for Order snapshot can be one of following: NTV,NFX,\n" + " ESPD,XNFI,ICE,ISE,DEA,DEX,BYX,BZX,BATE,CHIX,CEUX,BXTR,IST,BI20,\n" + " ABE,FAIR,GLBX,ERIS,XEUR,CFE,C2OX,SMFE...\n" + " c) source for MarketMaker snapshot, can be COMPOSITE_ASK\n" + " or COMPOSITE_BID\n" + " snapshot - Use keyword 'snapshot' for create snapshot subscription,\n" + " otherwise leave empty\n" + $" -l <records_print_limit> - The number of displayed records (0 - unlimited, default: {DEFAULT_RECORDS_PRINT_LIMIT})\n" + " -T <token> - The authorization token\n\n" + " -s <subscr_data> - The subscription data: ticker|TICKER, stream|STREAM, history|HISTORY\n" + " -p - Enables the data transfer logging\n\n" + "examples:\n" + " events: dxf_client demo.dxfeed.com:7300 Quote,Trade MSFT.TEST,IBM.TEST\n" + " events: dxf_client demo.dxfeed.com:7300 Quote,Trade MSFT.TEST,IBM.TEST -s stream\n" + " order: dxf_client demo.dxfeed.com:7300 Order MSFT.TEST,IBM.TEST NTV,IST\n" + " candle: dxf_client demo.dxfeed.com:7300 Candle XBT/USD{=d} 2016-10-10\n" + " underlying: dxf_client demo.dxfeed.com:7300 Underlyingn AAPL\n" + " series: dxf_client demo.dxfeed.com:7300 Series AAPL\n" + " order snapshot: dxf_client demo.dxfeed.com:7300 Order AAPL NTV snapshot\n" + " order snapshot: dxf_client demo.dxfeed.com:7300 Order AAPL NTV snapshot -l 0\n" + " market maker snapshot: dxf_client demo.dxfeed.com:7300 Order AAPL COMPOSITE_BID snapshot\n" + " market maker snapshot: dxf_client demo.dxfeed.com:7300 Order AAPL COMPOSITE_BID snapshot -l 3\n" + " candle snapshot: dxf_client demo.dxfeed.com:7300 Candle XBT/USD{=d} 2016-10-10 snapshot\n" + " candle snapshot: dxf_client demo.dxfeed.com:7300 Candle XBT/USD{=d} 2016-10-10 snapshot -l 10\n" + " candle snapshot: dxf_client demo.dxfeed.com:7300 Candle XBT/USD{=d,pl=0.5} 2016-10-10 snapshot -l 10\n" ); return; } var address = args[HOST_INDEX]; EventType events; if (!Enum.TryParse(args[EVENT_INDEX], true, out events)) { Console.WriteLine($"Unsupported event type: {args[EVENT_INDEX]}"); return; } var symbols = args[SYMBOL_INDEX]; var sources = new InputParam <string[]>(new string[] { }); var isSnapshot = new InputParam <bool>(false); var dateTime = new InputParam <DateTime?>(null); var recordsPrintLimit = new InputParam <int>(DEFAULT_RECORDS_PRINT_LIMIT); var token = new InputParam <string>(null); var subscriptionData = new InputParam <EventSubscriptionFlag>(EventSubscriptionFlag.Default); var logDataTransferFlag = false; for (var i = SYMBOL_INDEX + 1; i < args.Length; i++) { if (!dateTime.IsSet && TryParseDateTimeParam(args[i], dateTime)) { continue; } if (!isSnapshot.IsSet && TryParseSnapshotParam(args[i], isSnapshot)) { continue; } if (!recordsPrintLimit.IsSet && i < args.Length - 1 && TryParseRecordsPrintLimitParam(args[i], args[i + 1], recordsPrintLimit)) { i++; continue; } if (!token.IsSet && i < args.Length - 1 && TryParseTaggedStringParam("-T", args[i], args[i + 1], token)) { i++; continue; } if (!subscriptionData.IsSet && i < args.Length - 1 && TryParseEventSubscriptionFlagParam("-s", args[i], args[i + 1], subscriptionData)) { i++; continue; } if (logDataTransferFlag == false && args[i].Equals("-p")) { logDataTransferFlag = true; i++; continue; } if (!sources.IsSet) { TryParseSourcesParam(args[i], sources); } } var snapshotString = isSnapshot.Value ? " snapshot" : string.Empty; var timeSeriesString = dateTime.IsSet && !isSnapshot.Value ? " time-series" : string.Empty; Console.WriteLine( $"Connecting to {address} for [{events}{snapshotString}]{timeSeriesString} on [{symbols}] ..."); NativeTools.InitializeLogging("dxf_client.log", true, true, logDataTransferFlag); var listener = new EventPrinter(); using (var con = token.IsSet ? new NativeConnection(address, token.Value, DisconnectHandler, ConnectionStatusChangeHandler) : new NativeConnection(address, DisconnectHandler, ConnectionStatusChangeHandler)) { IDxSubscription s = null; try { if (isSnapshot.Value) { s = con.CreateSnapshotSubscription(events, dateTime.Value, new SnapshotPrinter(recordsPrintLimit.Value)); } else if (dateTime.IsSet) { s = subscriptionData.IsSet ? con.CreateSubscription(events, dateTime.Value, subscriptionData.Value, listener) : con.CreateSubscription(events, dateTime.Value, listener); } else { s = subscriptionData.IsSet ? con.CreateSubscription(events, subscriptionData.Value, listener) : con.CreateSubscription(events, listener); } if (events.HasFlag(EventType.Order) && sources.Value.Length > 0) { s.SetSource(sources.Value); } if (events == EventType.Candle) { var candleSymbol = CandleSymbol.ValueOf(symbols); s.AddSymbol(candleSymbol); } else { s.AddSymbols(symbols.Split(',')); } Console.WriteLine("Press enter to stop"); Console.ReadLine(); } catch (DxException dxException) { Console.WriteLine($"Native exception occured: {dxException.Message}"); } catch (Exception exc) { Console.WriteLine($"Exception occured: {exc.Message}"); } finally { s?.Dispose(); } } }
public MenuCommandListenerInteractStop(CovenantAPI CovenantClient, EventPrinter EventPrinter) : base(CovenantClient, EventPrinter) { this.Name = "Stop"; this.Description = "Stop the Listener"; this.Parameters = new List <MenuCommandParameter>(); }