Пример #1
0
        public LottoXClient(RagingBullConfig rbConfig, OCRConfig ocrConfig, PortfolioDatabase database, MarketDataClient marketDataClient) : base(rbConfig, database, marketDataClient)
        {
            PositionBuilder    positionBuilder = new PositionBuilder(marketDataClient, database);
            FilledOrderBuilder orderBuilder    = new FilledOrderBuilder(marketDataClient, database);

            ImageToPositionsConverter = new ImageToPositionsConverter(ocrConfig, positionBuilder);
            ImageToOrdersConverter    = new ImageToOrdersConverter(ocrConfig, orderBuilder);
            QuantityConsistencyClient = new ImageConsistencyClient();
            HeaderConsistencyClient   = new ImageConsistencyClient();
            OrderConsistencyClient    = new ImageConsistencyClient();
        }
Пример #2
0
        public Worker(
            IHostApplicationLifetime hostApplicationLifetime,
            IOptions <RagingBullConfig> rbOptions,
            IOptions <TDAmeritradeConfig> tdOptions,
            IOptions <OCRConfig> ocrOptions,
            IOptions <GeneralConfig> generalOptions,
            IOptions <OrderConfig> orderOptions,
            IOptions <ElmahConfig> elmahOptions)
        {
            _hostApplicationLifetime = hostApplicationLifetime;
            _ragingBullConfig        = rbOptions.Value;
            _tdAmeritradeConfig      = tdOptions.Value;
            _ocrConfig     = ocrOptions.Value;
            _generalConfig = generalOptions.Value;
            _orderConfig   = orderOptions.Value;
            _elmahConfig   = elmahOptions.Value;

            ElmahClient = ElmahioAPI.Create(_elmahConfig.ApiKey);
            TDClient tdClient = new TDClient(_tdAmeritradeConfig);

            MarketDataClient = tdClient;
            string            lottoxDbPath   = _generalConfig.DatabasePath + "/LottoX.db";
            string            symbolsDbPath  = _generalConfig.DatabasePath + "/Symbols.db";
            PortfolioDatabase lottoxDatabase = new LitePortfolioDatabase(lottoxDbPath, symbolsDbPath);

            LivePortfolioClient = new LottoXClient(_ragingBullConfig, _ocrConfig, lottoxDatabase, MarketDataClient);

            if (_generalConfig.UsePaperTrade)
            {
                Log.Information("PAPER TRADING");
                string            paperDbPath        = _generalConfig.DatabasePath + "/Paper.db";
                string            paperSymbolsDbPath = _generalConfig.DatabasePath + "/PaperSymbols.db";
                PortfolioDatabase paperDatabase      = new LitePortfolioDatabase(paperDbPath, paperSymbolsDbPath);
                BrokerClient = new PaperTradeBrokerClient(paperDatabase, MarketDataClient);
            }
            else
            {
                Log.Information("*****Trading with real account");
                BrokerClient = tdClient;
            }
            OrderManager = new OrderManager(BrokerClient, MarketDataClient, _orderConfig);
        }
Пример #3
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Retrieve the OcrConfig of the OcrEngine object
            OCRConfig ocrConfig = ocrEngine.Config;

            //Set the Whitelist property to recognize numbers only
            ocrConfig.Whitelist = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };

            //Set the Image property of OcrEngine object
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Call the Process method to retrieve the results
            ocrEngine.Process();
        }
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Aspose.OCR.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            //Retrieve the OcrConfig of the OcrEngine object
            OCRConfig ocrConfig = ocrEngine.Config;

            //Set the Whitelist property to recognize numbers only
            ocrConfig.Whitelist = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };

            //Set the Image property of OcrEngine object
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            //Call the Process method to retrieve the results
            ocrEngine.Process();
        }
        public static void Run()
        {
            // ExStart:RecognizeWhiteListedCharacters
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OMR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Retrieve the OcrConfig of the OcrEngine object
            OCRConfig ocrConfig = ocrEngine.Config;

            // Set the Whitelist property to recognize numbers only
            ocrConfig.Whitelist = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };

            // Set the Image property of OcrEngine object
            ocrEngine.Image = ImageStream.FromFile(dataDir + "Sampleocr.bmp");

            // Call the Process method to retrieve the results
            ocrEngine.Process();
            // ExEnd:RecognizeWhiteListedCharacters
        }
Пример #6
0
 public ImageToOrdersConverter(OCRConfig config, ModelBuilder <FilledOrder> builder) : base(config, builder)
 {
 }
 public ImageToPositionsConverter(OCRConfig config, ModelBuilder <Position> builder) : base(config, builder)
 {
 }