Algodex API v1

💱 Algodex API

The following is the 1.0 backend API for Algodex. This is a DeFi service to allow users to trade assets on the Algorand network directly between each other, with wallets hosted elsewhere on MyAlgo Wallet.

The 2.0 backend is a major architectural refactoring and is currently under development.

Endpoints

Algodex Mainnet: https://app.algodex.com/[api here]

Algodex Testnet: https://testnet.algodex.com/[api here]

📝 API Documentation

Fetching a list of all orders for an ASA

Params

  • assetId: the asset ID to search orders for

  • getAssetInfo (optional): set to true to also return asset information

Example

https://testnet.algodex.com/algodex-backend/orders.php?assetId=15322902

Fetch Asset Orders

GET https://testnet.algodex.com/algodex-backend/orders.php

Returns orders for an asset

Query Parameters

NameTypeDescription

assetID*

22295876

{
   "sellASAOrdersInEscrow":[
      {
         "assetLimitPriceInAlgos":"9000.000000000000",
         "asaPrice":"9000.000000000000",
         "assetLimitPriceD":9000,
         "assetLimitPriceN":1,
         "algoAmount":498000,
         "asaAmount":987,
         "assetId":22295876,
         "appId":22045522,
         "escrowAddress":"ZJO7QGK3KASYG35D5N4CSX76OKPQLLTLJ6CZ6YTEG4GGT2OC235UJI3U6M",
         "ownerAddress":"ACWISBRHEYQKVILSCEDNWCNOSTMIOQIHV3KLPBXHDZAJHVZT7AYM6PE6ZE",
         "version":6,
         "minimumExecutionSizeInAlgo":0,
         "round":20353010,
         "unix_time":1647328756,
         "formattedPrice":"900.000000",
         "formattedASAAmount":"0.00987",
         "decimals":5
      },
      // More...
   ],
   "buyASAOrdersInEscrow":[
      {
         "assetLimitPriceInAlgos":"10.000000000000",
         "asaPrice":"10.000000000000",
         "assetLimitPriceD":10,
         "assetLimitPriceN":1,
         "algoAmount":4530000,
         "asaAmount":0,
         "assetId":22295876,
         "appId":22045503,
         "escrowAddress":"7ULXUOXU5XQ76G2QZL5ZGQZMCFJBBXU72ZCDIS5KCCDHAOLZDW4XS5HNBQ",
         "ownerAddress":"AK6WGVO34V2QPTXCJYNDZC32ZQQCZMTC3SRYPWQR4CCW266YX2CKL6H3W4",
         "version":6,
         "minimumExecutionSizeInAlgo":0,
         "round":22651961,
         "unix_time":1657060128,
         "formattedPrice":"1.000000",
         "formattedASAAmount":"4.53000",
         "decimals":5
      },
      // More...
   ]
}

Fetching a list of orders for a wallet

Params

  • ownerAddr: the owner address to search orders for

  • getAssetInfo (optional): set to true to also return asset information

Example

https://testnet.algodex.com/algodex-backend/orders.php?ownerAddr=SPFRPFCZR4OSKKTCNGY5KOCS55RXWC6VJYU7SGQ4EUEVFIDUPAL4EKLJ3Q

Fetch Wallet Orders

GET https://testnet.algodex.com/algodex-backend/orders.php

Returns orders for a wallet

Query Parameters

NameTypeDescription

ownerAddr*

{address}

{
    // Response
    
    "sellASAOrdersInEscrow":[],
    "buyASAOrdersInEscrow":[]
}

Fetching the trade history for an ASA

Params

  • assetId: the asset ID to search the trade history for

  • getAssetInfo (optional): set to true to also return asset information

Example

https://testnet.algodex.com/algodex-backend/trade_history.php?assetId=15322902

Fetch Asset TradeHistory

GET https://testnet.algodex.com/algodex-backend/trade_history.php

Returns trade history for asset

Query Parameters

NameTypeDescription

assetId

22295876

{
   "transactions":[
      {
         "PK_trade_history_id":666370,
         "transaction_id":null,
         "group_id":"jBVPEG4TgT8yxfC24lIqX6uKuo1nXy9tTX3b\/zlp8jk=",
         "unix_time":1657975266,
         "block_round":22863925,
         "application_id":22045503,
         "asset_id":22295876,
         "asaPrice":"10.000000000000",
         "algoAmount":2000,
         "asaAmount":200,
         "asaBuyerAddress":"AK6WGVO34V2QPTXCJYNDZC32ZQQCZMTC3SRYPWQR4CCW266YX2CKL6H3W4",
         "asaSellerAddress":"WE3IEXZEVEM63WYRA352BKEYN3F5I3ITNCJMKGUUROCNA3G5LEGDGJJDMQ",
         "tradeType":"sellASA",
         "formattedPrice":"1.000000",
         "formattedASAAmount":"0.00200"
      },
      // More...
   ]
}

Fetching the trade history for a wallet

Params

  • ownerAddr: the owner address to search the trade history for

  • getAssetInfo (optional): set to true to also return asset information

Example

https://testnet.algodex.com/algodex-backend/trade_history.php?ownerAddr=SPFRPFCZR4OSKKTCNGY5KOCS55RXWC6VJYU7SGQ4EUEVFIDUPAL4EKLJ3Q

Fetch Wallet TradeHistory

GET https://testnet.algodex.com/algodex-backend/trade_history.php

Query Parameters

NameTypeDescription

ownerAddr*

{address}

Wallet address

getAssetInfo

true

Boolean Query param

// Example response
{
   "allAssets": [
      {
         "created-at-round":15917936,
         "deleted":false,
         "index":22060777,
         "params":{
            "clawback":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "creator":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "decimals":2,
            "default-frozen":false,
            "freeze":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "manager":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "name":"WaveCoin",
            "name-b64":"V2F2ZUNvaW4=",
            "reserve":"XTEI2ZFNQJVFNOKZIS5WN7OVOKCUKGVL5MEBYSIVUXI76NAPR4G3KPFOJI",
            "total":20000000,
            "unit-name":"WAVE",
            "unit-name-b64":"V0FWRQ==",
            "url":"https:\/\/glasswave.co\/wavecoin",
            "url-b64":"aHR0cHM6Ly9nbGFzc3dhdmUuY28vd2F2ZWNvaW4="
         }
      }
    ],
    "transactions": [
        {
            "PK_trade_history_id": 666444,
            "transaction_id": null,
            "group_id": "B8kNQ9\/V\/GesMBDGLpfA69jOxZM2TBaC5B6VkFFcWT0=",
            "unix_time": 1658130896,
            "block_round": 22900760,
            "application_id": 22045503,
            "asset_id": 22060777,
            "asaPrice": "90000.000000000000",
            "algoAmount": 900000,
            "asaAmount": 10,
            "asaBuyerAddress": "ZXPEYJMWFLULILWJHWB3Y6DFI4ADE7XVMGARAH734ZJ5ECXAR4YVMRZ4EM",
            "asaSellerAddress": "TQS4D62BRXX6XQY72EESMUPYVNN45MP2UYHNXP7UTFKOMINDTJCC3N5XWU",
            "tradeType": "buyASA",
            "formattedPrice": "9.000000",
            "formattedASAAmount": "0.10"
        },
    ]
}

Fetching all recently traded ASAs, their prices, and information

Params

None currently. This will eventually have different sort parameters.

Fetching chart info for an ASA

This currently returns the trades aggregated for the daily frequency. This will eventually different chart options

Params

assetId: the asset ID to get the chart information for chartTime: Time interval to pick from ['1m', '5m', '15m', '1h', '4h', '1d']

Example

https://testnet.algodex.com/algodex-backend/charts2.php?assetId=15322902&chartTime=15m

Fetch Asset Chart

GET https://testnet.algodex.com/algodex-backend/charts2.php

Returns chart for an Asset

Query Parameters

NameTypeDescription

assetId*

15322902

Asset ID

chartTime*

15m

Can be either of ['1m', '5m', '15m', '1h', '4h', '1d']

{
   // Response
   "current_price":"758.006622516556",
   "previous_trade_price":"758.006622516556",
   "last_period_closing_price":"758.006622516556",
   "asset_info":{
      "asset":{
         "created-at-round":13596306,
         "deleted":false,
         "index":15322902,
         "params":{
            "clawback":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "creator":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "decimals":6,
            "default-frozen":false,
            "freeze":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "manager":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "name":"Lamps",
            "name-b64":"TGFtcHM=",
            "reserve":"PBSSJ2W6FDXVRPT4L4FGHTX2IHY3VREI44SB7VJTVT75UT6ER3CTVD6B74",
            "total":100000000000,
            "unit-name":"LAMP",
            "unit-name-b64":"TEFNUA=="
         }
      }
   },
   "chart_data":[
      {
         "asaVolume":0.000604,
         "algoVolume":0.457836,
         "low":"758.006622516556",
         "formatted_low":"758.006623",
         "high":"758.006622516556",
         "formatted_high":"758.006623",
         "close":"758.006622516556",
         "formatted_close":"758.006623",
         "open":"758.006622516556",
         "formatted_open":"758.006623",
         "dateTime":"2022-07-26T16:30:00Z",
         "unixTime":1658853000,
         "date":"2022-07-26"
      },
      {
         "asaVolume":0.000604,
         "algoVolume":0.457836,
         "low":"758.006622516556",
         "formatted_low":"758.006623",
         "high":"758.006622516556",
         "formatted_high":"758.006623",
         "close":"758.006622516556",
         "formatted_close":"758.006623",
         "open":"758.006622516556",
         "formatted_open":"758.006623",
         "dateTime":"2022-07-26T14:30:00Z",
         "unixTime":1658845800,
         "date":"2022-07-26"
      },
      // More...
   ],
   "spread_info":{
      "max_bid":"1801.0000",
      "min_sell":"953.0302",
      "spread":-847.9698
   }
}

Getting complete asset information for an asset that is traded or untraded

This will fetch asset for an information that is either traded or untraded

Params

  • assetId: the assetId of the asset

Searching Asset information by name or ID

This will query both Algodex and Algoexplorer and present results for both

Params

query: The query string. This can be an integer (for the asset id), or a string to search for the asset name or unit name. Partial name matches work as well.

Examples

Search Assets

GET https://testnet.algodex.com/algodex-backend/asset_search.php

Search for an asset

Query Parameters

NameTypeDescription

query*

15322902

User can query by [Asset ID, Asset Name]

[
    {
        "assetName": "Lamps",
        "unitName": "LAMP",
        "verified": false,
        "destroyed": false,
        "assetId": 15322902,
        "isTraded": true,
        "decimals": 6,
        "total": 100000000000,
        "priceChg24Pct": 0.0007417558230212168,
        "price": "758.006622516556",
        "formattedPrice": "758.006623",
        "hasOrders": true,
        "formattedASALiquidity": "140.339924",
        "formattedAlgoLiquidity": "234882.457618"
    }
]

Getting package and smart contract version

This is for checking compatibility between the client and the server. If the escrowContractVersion is different, then any orders placed into the order book will not show up in the UI!

Getting asset information for a wallet address

This will query Algodex and return all the assets belonging to a wallet, along with price information and how many are in orders

Params

  • ownerAddr: the owner address to retrieve the assets for.

Examples

Fetch Wallet Assets

GET https://testnet.algodex.com/algodex-backend/wallet_assets.php

Returns asset for a wallet

Query Parameters

NameTypeDescription

ownerAddr*

{address}

Wallet Address

{
    "allAssets": [
        {
            "assetId": 16525344,
            "amount": 48596878092,
            "asaInOrder": 0,
            "name": "Alex Play 1",
            "unit_name": "ALEX1",
            "decimals": 5,
            "formattedTotalASAAmount": "485968.78092",
            "formattedASAInOrder": "0",
            "formattedASAAvailable": "485968.78092",
            "formattedPrice": null,
            "formattedTotalAlgoEquiv": null
        },
        {
            "assetId": 24253358,
            "amount": 1,
            "asaInOrder": 0,
            "name": "AlgoDesk Test ASA",
            "unit_name": "AD-TEST",
            "decimals": 0,
            "formattedTotalASAAmount": "1",
            "formattedASAInOrder": "0",
            "formattedASAAvailable": "1",
            "formattedPrice": null,
            "formattedTotalAlgoEquiv": null
        },
    ]
}

Getting asset information for all assets

Examples

Fetch Assets

GET https://api-testnet-public.algodex.com/algodex-backend/assets.php

Return assets list

Query Parameters

NameTypeDescription

id

22295876

Asset ID (Returns single object}


// Example response without ID Query
{
   "ok":true,
   "rows":366,
   "data":[
      {
         "id":15322902,
         "unix_time":1658853136,
         "price":758.006622516556,
         "priceBefore":758.001,
         "price24Change":0.0007417558230212168,
         "isTraded":true
      },
      {
         "id":33698417,
         "unix_time":1658331321,
         "price":0.760032540259,
         "priceBefore":0.760032540259,
         "price24Change":0,
         "isTraded":true
      },
   ]
}

// Example response with ID Query
{
   "ok":true,
   "rows":1,
   "data":[
      {
         "id":22295876,
         "unix_time":1657975266,
         "price":10,
         "priceBefore":10,
         "price24Change":0,
         "isTraded":true
      }
   ]
}

Last updated