9

For example, I see a few here: https://coinmarketcap.com/exchanges/stellar-decentralized-exchange/

Are there more, and if so what's the data source?

Thank you.

1

4 Answers 4

9

An asset on the stellar network is defined by its asset code (max 12 characters long code) and issuer. For example CNY and Ripplefox (GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX).

If you have access to a stellar-core instance database, the orderbook is contained in the offers table of the score database. The table schema is the following:

                Table "public.offers"
      Column      |         Type          | Modifiers 
------------------+-----------------------+-----------
 sellerid         | character varying(56) | not null
 offerid          | bigint                | not null
 sellingassettype | integer               | not null
 sellingassetcode | character varying(12) | 
 sellingissuer    | character varying(56) | 
 buyingassettype  | integer               | not null
 buyingassetcode  | character varying(12) | 
 buyingissuer     | character varying(56) | 
 amount           | bigint                | not null
 pricen           | integer               | not null
 priced           | integer               | not null
 price            | double precision      | not null
 flags            | integer               | not null
 lastmodified     | integer               | not null

To get a list of all unique asset pair, we run the following sql query:

select distinct sellingassettype, sellingassetcode, sellingissuer,
       buyingassettype, buyingassetcode, buyingissuer
from offers;

Which returns around 216 assets pairs.

While the columns assetcode and issuer are self-explanatory, assettype may need some explanation. At the low-level stellar has 3 assets: Native, and 2 for Credit assets (one with code of maximum 4 characters, another with maximum 12). In the database, assettype = 0 is the native assets (Lumens), 1 is the 4 char code asset, and 2 is the 12 char code asset.

From the same table, you can extract the orderbook data you need for each individual asset.

1
  • 2
    It should be noted that this requires access to the internal database of a stellar-core node instance.
    – David M.
    Commented Jan 21, 2018 at 13:15
4

Agree with the other answer - looking into internal database is the easiest and most comprehensive way.

But if you don't run your own node, then you could just query horizon:

https://horizon.stellar.org/assets?limit=100&cursor=0

and then request orderbook for each pair you're interested in

1
  • This is great, much appreciated.
    – Trae
    Commented Jan 22, 2018 at 3:06
2

StellarTerm maintains and uses a list of pairs in the stellarterm directory here.

0
1

There's a pretty good list here on StellarExpert.

1
  • 1
    Nice, thanks. Do you know the specific data source via Stellar?
    – Trae
    Commented Jan 21, 2018 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.