Ejemplo n.º 1
0
        //worst case. buy offer and sell bid
        private void CalcSpreadQuote()
        {
            Quote spreadQuote = new Quote();
            spreadQuote.bid = market.ask(tickers[0]) * multipliers[0] * ratio[0]
                                    - market.bid(tickers[1]) * multipliers[1] * ratio[1];
            spreadQuote.ask = market.bid(tickers[0]) * multipliers[0] * ratio[0]
                                    - market.ask(tickers[1]) * multipliers[1] * ratio[1];
            spreadQuote.symbol = "spread";

            spreads.Add(spreadQuote);

            if (spreads.Count > pricelength)
            {
                spreads.RemoveAt(0);
            }
        }
Ejemplo n.º 2
0
 public void trade(string sym, double bid, double ask)
 {
     if (!mktdict.ContainsKey(sym))
     {
         Quote quote = new Quote();
         quote.bid = bid;
         quote.ask = ask;
         mktdict[sym] = quote;
     }
     else
     {
         mktdict[sym].bid = bid;
         mktdict[sym].ask = ask;
     }
 }