void Destroy() { m_stopWatch.Stop(); m_logicTickerMgrTest.Stop(); m_logicTickerMgrTest.Release(); m_stopWatch = null; m_logicTickerMgrTest = null; }
public void AreTheseFuturesExpiryCode() { var mgr = new TickerManager(); Assert.IsTrue(mgr.IsFuturesExpiryCode("M4")); Assert.IsFalse(mgr.IsFuturesExpiryCode("M44")); Assert.IsTrue(mgr.IsFuturesExpiryCode("F5")); Assert.IsFalse(mgr.IsFuturesExpiryCode("A5")); Assert.IsFalse(mgr.IsFuturesExpiryCode("FG")); }
public void AreTheseTenors() { var mgr = new TickerManager(); Assert.IsTrue(mgr.IsTenor("0001M")); Assert.IsTrue(mgr.IsTenor("00012Y")); Assert.IsTrue(mgr.IsTenor("4D")); Assert.IsTrue(mgr.IsTenor("0001W")); Assert.IsFalse(mgr.IsTenor("W0001W")); Assert.IsFalse(mgr.IsTenor("0001F")); Assert.IsFalse(mgr.IsTenor("BP0001M")); }
public void AreTheseISINs() { var mgr = new TickerManager(); Assert.IsTrue(mgr.IsIsin("SE0005686144")); Assert.IsTrue(mgr.IsIsin("US0378331005")); Assert.IsTrue(mgr.IsIsin("AU0000XVGZA3")); Assert.IsTrue(mgr.IsIsin("GB0002634946")); Assert.IsFalse(mgr.IsIsin("XS09756342004")); Assert.IsFalse(mgr.IsIsin("WIMHY US")); Assert.IsFalse(mgr.IsIsin("AU0000XVGZAA")); }
public void AreTheseBloombergGlobalIDsEquities() { var mgr = new TickerManager(); Assert.IsTrue(mgr.BloombergGlobalIsEquity("BBG000BB5SQ7")); Assert.IsTrue(mgr.BloombergGlobalIsEquity("BBG000BDZQP5")); Assert.IsTrue(mgr.BloombergGlobalIsEquity("BBG000BF2304")); Assert.IsTrue(mgr.BloombergGlobalIsEquity("BBG000BGX8Y0")); Assert.IsTrue(mgr.BloombergGlobalIsEquity("BBG000BRFCC1")); Assert.IsFalse(mgr.BloombergGlobalIsEquity("BBG000FLF7J4")); Assert.IsFalse(mgr.BloombergGlobalIsEquity("BBG000FLF6H8")); Assert.IsFalse(mgr.BloombergGlobalIsEquity("BBG000DSM9K7")); Assert.IsFalse(mgr.BloombergGlobalIsEquity("BBG000F79QX4")); }
void Start() { m_stopWatch = new Stopwatch(); m_stopWatch.Start(); Application.targetFrameRate = 60; m_logicTickerMgrTest = new TickerManager(); m_logicTickerMgrTest.IsLogic = true; m_logicTickerMgrTest.IsNativeLogic = true; m_logicTickerMgrTest.IsServer = true; m_logicTickerMgrTest.SetLogicFrameRate(GameLogicDefs.GAME_LOGIC_FRAME_RATE); m_logicTickerMgrTest.Init(); m_logicTickerMgrTest.Start(); }
void GameLogicUpdate(long currentTime) { bool isOnline = GameGlobalData.GameTestOnline; if (!isOnline) { if (m_logicTickerMgrTest != null) { m_logicTickerMgrTest.UpdateTicker(); } } else { if (m_logicTickerMgrTest != null) { m_logicTickerMgrTest.UpdateTicker(); } } TickerManager.UpdateGlobalTick(); }
public BergTicker(string inputTicker) { var mgr = new TickerManager(); RawValue = inputTicker; BergTickerClean = inputTicker.ToUpper().Trim().Replace(" ", " "); TorLongType = mgr.GetTorontoLongType(BergTickerClean); if (TorLongType == "UNKNOWN") { Utils.Logger.Info(TorLongType + " - " + inputTicker); } else { Utils.Logger.Info("\t\t " + TorLongType + " - " + inputTicker); } TorTickerLookup = mgr.GetPrimaryLookUpString(BergTickerClean, TorLongType); TorTickerLookup2 = mgr.GetSecondaryLookUpString(BergTickerClean, TorLongType); BergIdType = mgr.GetBergIdType(BergTickerClean, TorLongType); TorId = mgr.GetTorontoId(this); TorPullType = mgr.GetTorontoPullType(TorLongType); }
//public System.Net.Http.HttpC #region Initialization public Koala(BotConfig config) { Bot = this; this.Logger = new Logger("BOT", null); this.Configuration = config; //Configure redis Logger.Log("Creating new Stack Exchange Client"); this.Redis = new StackExchangeClient(config.Redis.Address, config.Redis.Database, Logger.CreateChild("REDIS")); Namespace.SetRoot(config.Redis.Prefix); GuildSettings.DefaultPrefix = config.Prefix; Logger.Log("Creating new Database Client"); this.DbContext = new DbContext(config.SQL, logger: Logger.CreateChild("DB")); Logger.Log("Creating Starwatch Client"); this.Starwatch = new StarwatchClient(config.Starwatch.Host, config.Starwatch.Username, config.Starwatch.Password); //Configure Discord Logger.Log("Creating new Bot Configuration"); this.Discord = new DiscordClient(new DiscordConfiguration() { Token = config.Token }); //Make sure the user isn't updating to bypass moderative actions Logger.Log("Creating Instances...."); ModerationManager = new ModerationManager(this); PermissionManager = new PermissionManager(this, Logger.CreateChild("PERM")); ReplyManager = new ReplyManager(this, Logger.CreateChild("REPLY")); ReactRoleManager = new ReactRoleManager(this, Logger.CreateChild("ROLE")); TickerManager = new TickerManager(this, Logger.CreateChild("TICKER")) { Interval = 120 * 1000 }; TickerManager.RegisterTickers(new ITickable[] { new TickerStarwatch(Starwatch), new TickerMessageCount(), new TickerStarwatch(Starwatch), new TickerRandom(), }); //Track how many messages are sent Logger.Log("Creating Message Counter"); this.MessageCounter = new MessageCounter(this, config.MessageCounterSyncRate * 1000); //Setup some deps Logger.Log("Creating Dependencies & Registering Commands"); var deps = new ServiceCollection() .AddSingleton(this) .BuildServiceProvider(true); this.CommandsNext = this.Discord.UseCommandsNext(new CommandsNextConfiguration() { PrefixResolver = ResolvePrefix, Services = deps }); this.CommandsNext.RegisterConverter(new PermissionArgumentConverter()); this.CommandsNext.RegisterConverter(new MemberPermissionArgumentConverter()); this.CommandsNext.RegisterConverter(new QueryConverter()); this.CommandsNext.RegisterConverter(new CommandQueryArgumentConverter()); this.CommandsNext.RegisterConverter(new Starwatch.CommandNext.WorldConverter(this)); var curr = Assembly.GetExecutingAssembly(); var part = Assembly.GetAssembly(typeof(Modules.Starwatch.StarwatchModule.ProtectionModule)); this.CommandsNext.RegisterCommands(part); this.CommandsNext.CommandExecuted += HandleCommandExecuteAsync; Logger.Log("Creating Interactivity"); this.Interactivity = this.Discord.UseInteractivity(new InteractivityConfiguration() { PaginationBehaviour = DSharpPlus.Interactivity.Enums.PaginationBehaviour.Ignore, PaginationDeletion = DSharpPlus.Interactivity.Enums.PaginationDeletion.DeleteEmojis }); //Catch when any errors occur in the command handler //Send any command errors back after logging it. Logger.Log("Registering Error Listeners"); this.Discord.ClientErrored += async(error) => await LogException(error.Exception); this.CommandsNext.CommandErrored += HandleCommandErrorAsync; Logger.Log("Done"); }
public static async Task Main(string[] args) { if (File.Exists(ConfigurePath)) { ApplicationConfig = await LoadConfigAsync().ConfigureAwait(false); } else { await SaveConfigAsync(new Config()).ConfigureAwait(false); return; } DiscordClientConfig = new DiscordSocketConfig() { LogLevel = LogSeverity.Verbose }; DiscordClient = new DiscordSocketClient(DiscordClientConfig); DiscordClient.Log += RequestLogAsync; DiscordClient.Ready += () => Task.WhenAny(/* NotificationManager.InitAsync() ,*/ TippingManager.WorkAsync(), /* MonitorManager.WorkAsync() ,*/ TickerManager.WorkAsync(), Task.Delay(0)); await ModuleManager.InstallAsync().ConfigureAwait(false); await DiscordClient.LoginAsync(TokenType.Bot, ApplicationConfig.DiscordToken).ConfigureAwait(false); await DiscordClient.StartAsync().ConfigureAwait(false); while (!CancellationTokenSource.Token.IsCancellationRequested) { await Task.Delay(1024).ConfigureAwait(false); } }