BitShares Forum
		Main => Technical Support => Topic started by: madforstrength on January 19, 2016, 05:05:07 am
		
			
			- 
				Hi I am trying to integrate bitshares payment gateway in one of my project. Right now the problem I am facing is that I need the list of smarcoins similar to cryptofresh.com along with holders, price feed, active/inactive and settlement information.
I am currently using:
https://bitshares.openledger.info/ws/
with params:
{"id":2,"method":"list_assets","params":["",100]} 
But I am not getting any demarcation for which assests are smartcoins and which are user issued, also I am not getting holders, price feed and etc
And there is also a limit of 100 assets on api call.
I couldnt find any API of cryptofresh.com, all I could find was just this URL:
http://cryptofresh.com/api/cmc
I would appreciate if someone can guide me in the right direction.
			 
			
			- 
				Hi madforstrength,
and welcome to the community!
those assets that have a "bitasset_data_id" are bitassets. If you want to know more about the bitasset-aspect (price feed etc) of the asset, you can use 
{"id":2,"method":"get_objects","params":[["2.4.21"]]} 
			 
			
			- 
				As you've noticed there's no easy way to get a full list of assets, or a list of either bitassets/uias. Like xeroc said bit assets will have a "bitasset_data_id", and you can fetch that object to get more information such as feeds. The bitasset_data object also contains a boolean "is_prediction_market" that tells you if it's a binary prediction market or not.
The best way to get all assets is simply to start at "A" fetching 100 assets with:
{"id":2,"method":"list_assets","params":["A",100]}
then fetch 100 more starting from the last one in that set, and repeat until you don't find any more assets.
			 
			
			- 
				Hello guyz thankyou so much for your prompt response.
@xeroc I have tried what you mention but I am getting following response:
"id": "2.4.21",
            "feeds": [
                [
                    "1.2.167",
                    [
                        "2016-01-12T20:01:48",
                        {
                            "settlement_price": {
                                "base": {
                                    "amount": 16,
                                    "asset_id": "1.3.121"
                                },
                                "quote": {
                                    "amount": 51551,
                                    "asset_id": "1.3.0"
                                }
                            },
                            "maintenance_collateral_ratio": 1750,
                            "maximum_short_squeeze_ratio": 1100,
                            "core_exchange_rate": {
                                "base": {
                                    "amount": 16,
                                    "asset_id": "1.3.121"
                                },
                                "quote": {
                                    "amount": 48973,
                                    "asset_id": "1.3.0"
                                }
                            }
                        }
                    ]
                ],
Which only has one asset 1.3.121 and it does not contain any "bitasset_data_id". Am I missing something?
Thanks in advance, Really appreciate your help
			 
			
			- 
				@svk Thanks for your response,
Well the method you are saying is quite tedious but practical, I will have it as last resort.
I can fetch the list of smartcoins by filtering on assets having "bitasset_data_id" but I still do not get the Holders and active/inactive status of asset.
Would appreciate if you can help me in this regard.
			 
			
			- 
				I think the current witness/wallet api does not have a call to show the holders of a particular asset but it will hopefully have something like this in the future ... cryptofresh has its own backend database to do that kind of think
			
 
			
			- 
				There's one other endpoint on cryptofresh that might help: http://cryptofresh.com/api/holders?asset=OPENMUSE (it shows only balance, not orders/collateral)
When it comes to active/inactive.. I split the assets based on their 'current_supply': 0 means inactive, greater than 0 means active. 
			 
			
			- 
				Hi guys,
Thanks a lot to all of you for your help.
I have created a recursive function to get the list of all assets (as mentioned by @svk )
Then I filtered the assets in to smartcoins and userIssuedAssets by checking if they contain "bitasset_data_id" and their issuer is "1.2.0" (as mentioned by @xeroc )
After that I fetched number of holders of each asset from http://cryptofresh.com/api/holders?asset=OPENMUSE (as mentioned by @roadscape )
I got around 15 smartcoins having holders>0 and 45 userIssuedAssets having holders>3. This is perfectly fine.
Now to remove settled assets from this list I am fetching objects using "bitasset_data_id" and checking if the "settlement_fund" > 0 then the asset is settled. is it ok?
			 
			
			- 
				
Hi guys,
Thanks a lot to all of you for your help.
I have created a recursive function to get the list of all assets (as mentioned by @svk )
Then I filtered the assets in to smartcoins and userIssuedAssets by checking if they contain "bitasset_data_id" and their issuer is "1.2.0" (as mentioned by @xeroc )
After that I fetched number of holders of each asset from http://cryptofresh.com/api/holders?asset=OPENMUSE (as mentioned by @roadscape )
I got around 15 smartcoins having holders>0 and 45 userIssuedAssets having holders>3. This is perfectly fine.
Now to remove settled assets from this list I am fetching objects using "bitasset_data_id" and checking if the "settlement_fund" > 0 then the asset is settled. is it ok?
You may have filtered out TCNY and TUSD, which are private smart coins.
			 
			
			- 
				@abit yes I am doing it deliberately.