Exemplo n.º 1
0
 /// <summary>
 /// Make all action to retrieve configuration from database
 /// and initialize the singleton configuration object.
 /// </summary>
 public static void BuildAndInitializeConfiguration()
 {
     _allConfigurations = new AllConfigurations();
     BuildConfiguration();
     //Update the reference on Global:
     AllConfigurations.AllConfigurationsObject = _allConfigurations;
 }
Exemplo n.º 2
0
 public void SaveConfig(AllConfigurations config)
 {
     using (var r = new StreamWriter(_path))
     {
         var json = Newtonsoft.Json.JsonConvert.SerializeObject(config, Formatting.Indented);
         r.Write(json);
     }
 }
Exemplo n.º 3
0
        public static void WriteConfigurationFromScratch(ConfigHandler configHandler)
        {
            AllConfigurations allConfigurations = new AllConfigurations
            {
                Application =
                {
                    DefaultHost      = "127.0.0.1",
                    AppClientId      =                       11,
                    AppPort          =                     7496,//7496,4001,
                    MainAccount      = "U1450837",
                    WDAppClientId    =                       12,
                    DBWritePeriod    = TimeSpan.FromSeconds(60),
                    AllowAutoTrading = false,
                },
                Session =
                {
                    AAPLHighLoadingStrike   =                          100,
                    AAPLLowLoadingStrike    =                          200,
                    AAPLSessionsToLoad      = "20170817;20151016;20160115",
                    HighStrikePercentage    =                           30,
                    LowStrikePercentage     =                           30,
                    MinimumDaysToExpiration =                           50,
                    MaxmumDaysToExpiration  =                          160,
                },
                Trading =
                {
                    AllowedDeltaOffset        =          30,
                    USAInterestPercentage     =        0.25,
                    StatisticsSaveIntervalSec =         300,
                    DeltaLossThreshold        =        0.25,
                    PolicyID              =           3,
                    AlgorithmType         =           2,
                    OTMOffsetPut          =          12,
                    OTMOffsetCall         =          10,
                    UNLSymbolsList        = "AAPL;MSFT",
                    RiskFreeInterestRate  =        0.01,
                    InitNetLiquidation    =      210300,
                    OrderInterval         =        1500,
                    MinPriceStep          =        0.01,
                    MaxDeltaAllowed       =        0.56,
                    MinDeltaAllowed       =        0.43,
                    MaxDeltaOffsetAllowed = 0.07
                }
            };


            configHandler.SaveConfig(allConfigurations);
        }