BitShares Forum
		Main => Technical Support => Topic started by: Xeldal on October 29, 2015, 12:11:48 am
		
			
			- 
				Noticed in the return from list_account_balances all "amount" fields are integers with the exception of asset "1.3.0" (BTS) which returns as a string?
Is there a reason for this?
BitShares-2.15.294-x64-cli-tools
[
   {
      "amount":"11271",   <----- String
      "asset_id":"1.3.0"
   },
   {
      "amount":49990,      <------- Integer
      "asset_id":"1.3.535"
   },
   {
      "amount":4808,     <------- Integer
      "asset_id":"1.3.103"
   },
   {
      "amount":449,     <------- Integer
      "asset_id":"1.3.113"
   },
   {
      "amount":5007,
      "asset_id":"1.3.121"
   },
   {
      "amount":10,
      "asset_id":"1.3.127"
   }
] 
			 
			
			- 
				In addition.  From API call "get_limit_orders BTS BTC 10" .  9 out of 10 amount entries are Integers and 1 is a string for the same 1.3.0 asset.
wtf?  is the string entry an old order placed under a different version? or is it something else?
  },{
    "id": "1.7.1599",
    "expiration": "2020-10-23T19:07:31",
    "seller": "1.2.137",
    "for_sale": 568625028,
    "sell_price": {
      "base": {
        "amount": 888000000,     <--------Integer
        "asset_id": "1.3.0"             <---BTS
      },
      "quote": {
        "amount": 12000000,
        "asset_id": "1.3.103"     
      }
    }
  },{
    "id": "1.7.1533",
    "expiration": "2020-10-23T09:30:05",
    "seller": "1.2.34307",
    "for_sale": "7325100000",     
    "sell_price": {
      "base": {
        "amount": "7325100000",     <----------String
        "asset_id": "1.3.0"                  <-----BTS
      },
      "quote": {
        "amount": 100000000,
        "asset_id": "1.3.103"
      }
    }
  },{
			 
			
			- 
				is this the intended function?   surely I'm not the only one who's run into this.  If this is only a problem in my mind, I'd appreciate someone pointing it out.
Currently the API is a mess to try and use.  BTS1 API was bad but BTS2 is actually worse.  To get the information I need anywhere else It generally takes 1 API call.  With BitShares it takes 3 or 4.   Not to mention all these special cases where sometimes its presented one way and other times another.  What should take 50 lines of code ends up taking 200.   
			 
			
			- 
				
is this the intended function?   surely I'm not the only one who's run into this.  If this is only a problem in my mind, I'd appreciate someone pointing it out.
Currently the API is a mess to try and use.  BTS1 API was bad but BTS2 is actually worse.  To get the information I need anywhere else It generally takes 1 API call.  With BitShares it takes 3 or 4.   Not to mention all these special cases where sometimes its presented one way and other times another.  What should take 50 lines of code ends up taking 200. 
I saw the two different types too.  My guess is that some amounts are too large to be stored in an 'integer' type (since it depends on the interpreter/programming language  which receives the json message) and hence they use 'string' type for larger values (larger than an integer type can hold).
			 
			
			- 
				
is this the intended function?   surely I'm not the only one who's run into this.  If this is only a problem in my mind, I'd appreciate someone pointing it out.
Currently the API is a mess to try and use.  BTS1 API was bad but BTS2 is actually worse.  To get the information I need anywhere else It generally takes 1 API call.  With BitShares it takes 3 or 4.   Not to mention all these special cases where sometimes its presented one way and other times another.  What should take 50 lines of code ends up taking 200. 
I saw the two different types too.  My guess is that some amounts are too large to be stored in an 'integer' type (since it depends on the interpreter/programming language  which receives the json message) and hence they use 'string' type for larger values (larger than an integer type can hold).
I see.  Thanks.  If thats the case maybe we should just return everything as a string.  I don't know standard practice but it seems odd that we would mix types like that.