Beispiel #1
0
        private void OnSessionStatusChanged(object sender, SessionStatusEventArgs e)
        {
            var status = ConvertersInternal.GetSessionStatus(e.SessionStatus);

            this.SessionStatus = status;

            switch (status)
            {
            case FxConnectProxy.SessionStatus.Connected:
                this.PopulateProviders();

                if (this.UsingTableManager)
                {
                    this.PopulateTableManager();
                }
                break;

            case FxConnectProxy.SessionStatus.Disconnected:
            case FxConnectProxy.SessionStatus.SessionLost:
                this.DeinitSession();
                this.InitSession();
                break;
            }

            if (this.SessionStatusChanged != null)
            {
                this.SessionStatusChanged(this, new EventArgs <SessionStatusChanged>(new SessionStatusChanged()
                {
                    Status = status,
                }));
            }
        }
        public PermissionStatusResponse CanUseFluctuateTrailingForStop()
        {
            var result = this.Checker.canUseFluctuateTrailingForStop();

            return(new PermissionStatusResponse()
            {
                Status = ConvertersInternal.GetPermissionStatus(result),
            });
        }
        public PermissionStatusResponse CanUseDynamicTrailingForLimit()
        {
            var result = this.Checker.canUseDynamicTrailingForLimit();

            return(new PermissionStatusResponse()
            {
                Status = ConvertersInternal.GetPermissionStatus(result),
            });
        }
Beispiel #4
0
        public GetPriceUpdateModeResponse GetPriceUpdateMode()
        {
            var result = this.FxSession.getPriceUpdateMode();

            return(new GetPriceUpdateModeResponse()
            {
                PriceUpdateMode = ConvertersInternal.GetPriceUpdateMode(result),
            });
        }
        public RequestResponse RefreshTableRequest(RefreshTableRequest request)
        {
            this.Validator.Validate(request);

            var fxReq = this.FxRequestFactory.createRefreshTableRequest(ConvertersInternal.GetTableType(request.Table));

            this.FxSession.sendRequest(fxReq);

            return(Helpers.GetRequestResponse(fxReq));
        }
        public PermissionStatusResponse CanChangeNetStopLimitOrder(InstrumentBaseRequest request)
        {
            this.Validator.Validate(request);

            var result = this.Checker.canChangeNetStopLimitOrder(request.Instrument);

            return(new PermissionStatusResponse()
            {
                Status = ConvertersInternal.GetPermissionStatus(result),
            });
        }
        public PermissionStatusResponse CanRemoveFromContingencyGroup(InstrumentBaseRequest request)
        {
            this.Validator.Validate(request);

            var result = this.Checker.canRemoveFromContingencyGroup(request.Instrument);

            return(new PermissionStatusResponse()
            {
                Status = ConvertersInternal.GetPermissionStatus(result),
            });
        }
Beispiel #8
0
        public GetTableResponse GetTable(GetTableRequest request)
        {
            this.Validator.Validate(request);

            var table = this.Manager.getTable(ConvertersInternal.GetTableType(request.Table));

            return(new GetTableResponse()
            {
                Rows = this.Reader.ReadTable(table),
            });
        }
Beispiel #9
0
        public GetMarketStatusResponse GetMarketStatus(InstrumentBaseRequest request)
        {
            this.Validator.Validate(request);

            var result = this.Provider.getMarketStatus(request.Instrument);

            return(new GetMarketStatusResponse()
            {
                Status = ConvertersInternal.GetMarketStatus(result),
            });
        }
        public IsTableLoadedByDefaultResponse IsTableLoadedByDefault(GetTableRequest request)
        {
            this.Validator.Validate(request);

            var result = this.Rules.isTableLoadedByDefault(ConvertersInternal.GetTableType(request.Table));

            return(new IsTableLoadedByDefaultResponse()
            {
                IsLoaded = result,
            });
        }
        public GetTableResponse GetTableRefresh(GetTableRequest request)
        {
            this.Validator.Validate(request);

            var response = this.Rules.getTableRefreshResponse(ConvertersInternal.GetTableType(request.Table));

            return(new GetTableResponse()
            {
                Rows = this.Reader.ReadResponse(response),
            });
        }
Beispiel #12
0
        private void OnTableManagerStatusChanged(object sender, TableManagerStatusChangedEventArgs e)
        {
            var status = ConvertersInternal.GetTableManagerStatus(e.Status);

            this.TableManagerStatus = status;

            if (this.TableManagerStatusChanged != null)
            {
                this.TableManagerStatusChanged(this, new EventArgs <TableManagerStatusChanged>(new TableManagerStatusChanged()
                {
                    Status = status,
                }));
            }
        }
        private O2GValueMap GetValueMap(ValueMap valueMap)
        {
            if (valueMap == null)
            {
                return(null);
            }

            var result = this.FxRequestFactory.createValueMap();

            foreach (var v in valueMap.Values)
            {
                var p = ConvertersInternal.GetRequestParam(v.Param);
                switch (v.Type)
                {
                case ValueMapItemType.Boolean:
                    result.setBoolean(p, (v as ValueMapItem <bool>).Value);
                    break;

                case ValueMapItemType.Double:
                    result.setDouble(p, (v as ValueMapItem <double>).Value);
                    break;

                case ValueMapItemType.Int:
                    result.setInt(p, (v as ValueMapItem <int>).Value);
                    break;

                case ValueMapItemType.String:
                    result.setString(p, (v as ValueMapItem <string>).Value);
                    break;

                case ValueMapItemType.Command:
                    result.setString(p, Converters.GetRequestCommand((v as ValueMapItem <RequestCommand>).Value));
                    break;
                }
            }

            foreach (var child in valueMap.ChildMaps)
            {
                result.appendChild(GetValueMap(child));
            }

            return(result);
        }
Beispiel #14
0
        public void SetPriceUpdateMode(SetPriceUpdateModeRequest request)
        {
            this.Validator.Validate(request);

            this.FxSession.setPriceUpdateMode(ConvertersInternal.GetPriceUpdateMode(request.PriceUpdateMode));
        }