public FinancialInstrument(
     InstrumentTypes types,
     InstrumentIdentifiers identifiers,
     string name,
     string cfi,
     string securityCurrency,
     string issuerIdentifier,
     string underlyingName,
     string underlyingCfi,
     string underlyingIssuerIdentifier,
     string sectorCode,
     string industryCode,
     string regionCode,
     string countryCode)
 {
     this.Type                       = types;
     this.Identifiers                = identifiers;
     this.Name                       = name;
     this.Cfi                        = cfi;
     this.SecurityCurrency           = securityCurrency;
     this.IssuerIdentifier           = issuerIdentifier;
     this.UnderlyingName             = underlyingName;
     this.UnderlyingCfi              = underlyingCfi;
     this.UnderlyingIssuerIdentifier = underlyingIssuerIdentifier;
     this.SectorCode                 = sectorCode;
     this.IndustryCode               = industryCode;
     this.RegionCode                 = regionCode;
     this.CountryCode                = countryCode;
 }
示例#2
0
        private static Dictionary <InstrumentTypes, List <string> > GetInstrumentsPaths(string path)
        {
            Dictionary <InstrumentTypes, List <string> > paths = new Dictionary <InstrumentTypes, List <string> >();

            List <string> lines = File.ReadAllLines(path, Encoding.UTF8 /*GetEncoding(1251)*/).ToList();

            InstrumentTypes instrumentTypes          = InstrumentTypes.None;
            int             FolderSearchPhraseLength = FolderSearchPhrase.Length;

            foreach (string line in lines)
            {
                if (line.Contains(COINCheckPhrase))
                {
                    instrumentTypes = InstrumentTypes.COIN;
                    CreatePaths(paths, instrumentTypes);
                    continue;
                }
                else if (line.Contains(ETHUSDCheckPhrase))
                {
                    instrumentTypes = InstrumentTypes.ETHUSD;
                    CreatePaths(paths, instrumentTypes);
                    continue;
                }
                else if (instrumentTypes == InstrumentTypes.None)
                {
                    continue;
                }

                if (line.Length < FolderSearchPhraseLength)
                {
                    continue;
                }

                string strategyPath = line.Substring(FolderSearchPhraseLength);

                Console.WriteLine("{0}: {1}", instrumentTypes, strategyPath);

                paths[instrumentTypes].Add(strategyPath);
            }

            return(paths);
        }
示例#3
0
 public static IEnumerable<PricingItem> GetInstrumentTypes(this IEnumerable<PricingItem> source_, InstrumentTypes type_)
 {
   return source_.Where(x => x.InstrumentType == (int)type_);
 }
示例#4
0
 private static void CreatePaths(Dictionary <InstrumentTypes, List <string> > paths, InstrumentTypes instrumentTypes)
 {
     if (!paths.ContainsKey(instrumentTypes))
     {
         paths.Add(instrumentTypes, new List <string>());
     }
 }
示例#5
0
文件: Instrument.cs 项目: 9045857/Sew
 public Instrument(InstrumentTypes instrumentType, List <Strategy> strategies)
 {
     InstrumentType = instrumentType;
     Strategies     = strategies;
 }
示例#6
0
文件: GBM.cs 项目: diegoam/GBMRepo
        public OrderResponse GenerateOrder(string Ticker, int quantity, OrderTypes orderType, Decimal Price, InstrumentTypes instrumentType, ref bool RecurrenceFlag)
        {
            const string WEBSERVICE_URL = "https://homebroker-api.gbm.com/GBMP/api/Operation/RegisterCapitalOrder";

            try
            {
                if (RecurrenceFlag)
                {
                    var myHttpWebRequest = (HttpWebRequest)WebRequest.Create(WEBSERVICE_URL);
                    myHttpWebRequest.UserAgent   = "okhttp/3.10.0";
                    myHttpWebRequest.ContentType = "application/json";

                    myHttpWebRequest.Method = "POST";
                    myHttpWebRequest.Accept = "application/json";
                    myHttpWebRequest.Headers.Add("Authorization", "Bearer " + this.BearerKey);
                    myHttpWebRequest.Headers.Add("Accept-Encoding", "gzip");
                    myHttpWebRequest.Headers.Add("Mobile-platform", "android");


                    //string postData = "{\"electronicOrderId\":" + orderID + ",\"vigencia\":false,\"isPreDispatchOrder\":false}";
                    var           PostObject = new PurchaseOrderObject(ContractID, Ticker, quantity, orderType, Price, instrumentType);
                    var           postData   = PostObject.StringifyOrder();
                    ASCIIEncoding encoding   = new ASCIIEncoding();
                    byte[]        byte1      = encoding.GetBytes(postData);
                    myHttpWebRequest.ContentLength = byte1.Length;
                    Stream newStream = myHttpWebRequest.GetRequestStream();

                    newStream.Write(byte1, 0, byte1.Length);
                    // Console.WriteLine("The value of 'ContentLength' property after sending the data is {0}", myHttpWebRequest.ContentLength);

                    // Close the Stream object.

                    HttpWebResponse WebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
                    if (WebResponse.StatusDescription == "OK")
                    {
                        Stream responseStream = WebResponse.GetResponseStream();
                        if (WebResponse.ContentEncoding.ToLower().Contains("gzip"))
                        {
                            responseStream = new GZipStream(responseStream, CompressionMode.Decompress);
                        }
                        else if (WebResponse.ContentEncoding.ToLower().Contains("deflate"))
                        {
                            responseStream = new DeflateStream(responseStream, CompressionMode.Decompress);
                        }

                        StreamReader Reader = new StreamReader(responseStream, Encoding.Default);

                        string Html     = Reader.ReadToEnd();
                        var    JsonData = JsonConvert.DeserializeObject <OrderResponse>(Html);
                        //var definition = new { response = false };

                        // string json1 = @"{'Name':'James'}";
                        //var customer1 = JsonConvert.DeserializeAnonymousType(Html, definition);
                        //dynamic data = JObject.Parse(Html);
                        responseStream.Close();
                        return(JsonData);
                    }

                    WebResponse.Close();
                    RecurrenceFlag = false;
                }
            }
            catch (System.Net.WebException UnautorizedException)
            {
                this.Autenthicate();
                GenerateOrder(Ticker, quantity, orderType, Price, instrumentType, ref RecurrenceFlag);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(null);
        }
示例#7
0
 public static IEnumerable<PricingItem> GetAllForInstrumentType(IEnumerable<PricingItem> superset_, InstrumentTypes type_)
 {
   return superset_.Where(x=>x.InstrumentType==(int)type_);
 }