public static CryptsyAccountInfo Parse(JObject accountInfoJson) { TimeZoneInfo serverTimeZone = TimeZoneResolver.GetByShortCode(accountInfoJson.Value <string>("servertimezone")); DateTime serverDateTime = DateTime.Parse(accountInfoJson.Value <string>("serverdatetime")); serverDateTime = TimeZoneInfo.ConvertTimeToUtc(serverDateTime, serverTimeZone); return(new CryptsyAccountInfo( ParseWallets(accountInfoJson.Value <JObject>("balances_available"), accountInfoJson.Value <JObject>("balances_hold")), serverDateTime, serverTimeZone, accountInfoJson.Value <int>("openordercount") )); }
public static void ParseTransaction(List <Transaction> transactions, JObject jsonTransaction) { TimeZoneInfo serverTimeZone = TimeZoneResolver.GetByShortCode(jsonTransaction.Value <string>("timezone")); DateTime transactionPosted = DateTime.Parse(jsonTransaction.Value <string>("datetime")); TransactionType transactionType = (TransactionType)Enum.Parse(typeof(TransactionType), jsonTransaction.Value <string>("type")); transactionPosted = TimeZoneInfo.ConvertTimeToUtc(transactionPosted, serverTimeZone); Transaction transaction = new Transaction(jsonTransaction.Value <string>("currency"), transactionPosted, transactionType, Address.Parse(jsonTransaction["address"]), jsonTransaction.Value <decimal>("amount"), jsonTransaction.Value <decimal>("fee")); transactions.Add(transaction); }