public static MyOrder ParseMyOrder(JObject myOrderJson, MarketId marketId, TimeZoneInfo timeZone) { DateTime created = DateTime.Parse(myOrderJson.Value <string>("created")); CryptsyOrderId orderId = CryptsyOrderId.Parse(myOrderJson["orderid"]); OrderType orderType = (OrderType)Enum.Parse(typeof(OrderType), myOrderJson.Value <string>("ordertype")); created = TimeZoneInfo.ConvertTimeToUtc(created, timeZone); return(new MyOrder(orderId, orderType, created, myOrderJson.Value <decimal>("price"), myOrderJson.Value <decimal>("quantity"), myOrderJson.Value <decimal>("orig_quantity"), marketId )); }
public static MyTrade ParseMyTrade(JObject jsonTrade, MarketId defaultMarketId, TimeZoneInfo timeZone) { DateTime tradeDateTime = DateTime.Parse(jsonTrade.Value <string>("datetime")); JToken marketIdToken = jsonTrade["marketid"]; MarketId marketId = null == marketIdToken ? defaultMarketId : CryptsyMarketId.Parse(marketIdToken); CryptsyOrderId orderId = CryptsyOrderId.Parse(jsonTrade["order_id"]); CryptsyTradeId tradeId = CryptsyTradeId.Parse(jsonTrade["tradeid"]); OrderType tradeType = (OrderType)Enum.Parse(typeof(OrderType), jsonTrade.Value <string>("tradetype")); tradeDateTime = TimeZoneInfo.ConvertTimeToUtc(tradeDateTime, timeZone); return(new MyTrade(tradeId, tradeType, tradeDateTime, jsonTrade.Value <decimal>("tradeprice"), jsonTrade.Value <decimal>("fee"), jsonTrade.Value <decimal>("quantity"), marketId, orderId )); }