forked from ben-haim/BitMexExcel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarketData.cs
More file actions
47 lines (39 loc) · 1.25 KB
/
MarketData.cs
File metadata and controls
47 lines (39 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitMex
{
public class MarketDataSnapshot
{
public string Product;
//BBO
public decimal Bid { get { return BidDepth.Count > 0 ? BidDepth[0].Price : 0M; } }
public decimal BidVol { get { return BidDepth.Count > 0 ? BidDepth[0].Qty : 0M; } }
public decimal Ask { get { return AskDepth.Count > 0 ? AskDepth[0].Price : 0M; } }
public decimal AskVol { get { return AskDepth.Count > 0 ? AskDepth[0].Qty : 0M; } }
//Full depth
public List<MarketDepth> BidDepth = new List<MarketDepth>();
public List<MarketDepth> AskDepth = new List<MarketDepth>();
public MarketDataSnapshot(string product)
{
Product = product;
}
public override string ToString()
{
return Product + "{ " + BidVol + "@" + Bid + " / " + Ask + "@" + AskVol + "} ";
}
}
public class MarketDepth
{
public decimal Price;
public decimal Qty;
public MarketDepth() { }
public MarketDepth(decimal price, decimal qty)
{
Price = price;
Qty = qty;
}
}
}