示例#1
0
 /// <summary>
 /// Event Handler for Bitcoin Data Events: These weather objects are created from our
 /// "Weather" type below and fired into this event handler.
 /// </summary>
 /// <param name="data">One(1) Weather Object, streamed into our algorithm synchronised in time with our other data streams</param>
 public void OnData(Bitcoin data)
 {
     //If we don't have any weather "SHARES" -- invest"
     if (!Portfolio.Invested)
     {
         //Weather used as a tradable asset, like stocks, futures etc.
         if (data.Close != 0)
         {
             Order("BTC", (Portfolio.Cash / Math.Abs(data.Close + 1)));
         }
         Console.WriteLine("Buying BTC 'Shares': BTC: " + data.Close);
     }
     Console.WriteLine("Time: " + Time.ToLongDateString() + " " + Time.ToLongTimeString() + data.Close.ToString());
 }
 //Bitcoin Handler:
 public void OnData(Bitcoin data)
 {
     Debug(Time.ToLongTimeString() + " >> ALGO >> OnData(BTC) >> BTC: " + data.Close);
 }