Skip to content

Account transactions#14

Open
micvbang wants to merge 3 commits intoajph:masterfrom
micvbang:account-transactions
Open

Account transactions#14
micvbang wants to merge 3 commits intoajph:masterfrom
micvbang:account-transactions

Conversation

@micvbang
Copy link
Contributor

Hello,

I added support for the AccountTransactions endpoint.

On the surface, my implementation looks somewhat convoluted compared to the implementation of the rest of the endpoints. The reason is explained in my comment above the accountTransactionResult type:

// accountTransactionResult is used internally to ease the process of unmarshalling.
// For some reason, for the transaction endpoint, Bitstamp is sends numbers
// encoded as both strings and floats, intermingled. This means that we cannot
// use the `json:"name,string"` automagic conversion here.
type accountTransactionResult struct {
    ...
}

An example of inconsistent data returned by Bitstamp:

{
	"fee": "0.00000000",
	"order_id": 294995485,
	"eth_btc": 0.06907000,
	"datetime": "2017-09-15 15:52:47",
	"usd": 0.0,
	"btc": "0.01602514",
	"eth": "-0.23201300",
	"type": "2",
	"id": 21435498,
	"eur": 0.0  // <---
}, {
	"fee": "0.00",
	"order_id": 294984225,
	"datetime": "2017-09-15 15:46:53",
	"usd": 0.0,
	"btc": "0.03200000",
	"btc_eur": 3125.00000000,
	"type": "2",
	"id": 21433500,
	"eur": "-100.00"  // <---
}, {
	"fee": "0.00",
	"order_id": 294977112,
	"datetime": "2017-09-15 15:43:24",
	"usd": 0.0,
	"btc": 0.0,
	"eth": "0.46403712",
	"eth_eur": 215.30000000,
	"type": "2",
	"id": 21432376,
	"eur": "-99.91"  // <---
},

Here, we see that the "eur" property is returned both as a number and as a string.

@micvbang micvbang mentioned this pull request Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant