Tronsave
🇬🇧 English
🇬🇧 English
  • 📗INTRODUCTION
    • What is Tronsave ?
    • Why Tronsave?
  • Buyer
    • How to buy Energy ?
      • Buy on the Website
      • Buy on Telegram
        • 1. Create a Tronsave telegram account
        • 2. How To Deposit TRX
        • 3. Get the Tronsave API Key
        • 4. How to buy on Telegram
    • Extend
      • Quick extend
      • Advance
  • 🏬Seller
    • Get Energy by Staking 2.0
    • Permission
    • Sell Energy
      • Manual Sell
      • Auto Sell
      • Sell Suggestion
  • DEVELOPER
    • Get API key
      • On the Website
      • On Telegram
    • Buy Resources (v2)
      • Use Signed Transaction
        • Estimate TRX
        • Get Signed Transaction
        • Create order
      • Use API Key
        • Get Internal Account Info
        • Get Order Book
        • Estimate TRX
        • Create order
        • Get one order details
        • Get Internal Account Order History
    • Extend Orders (v2)
      • Step 1: Get Extendable Delegates
      • Step 2: Extend Request
    • Rest API v0
      • Buy on Rest API
        • Use Signed Transaction
          • Estimate TRX
          • Get Signed Transaction
          • Create order
          • Demo
        • Use API Key
          • Get Internal Account Info
          • Get Order Book
          • Estimate of TRX
          • Create order
          • Get one order details
          • Get Internal Account Order History
      • Extend with Rest API
  • 🤝Referrer
    • Referrals
  • 💡FAQ
    • Questions for Energy market
    • Calculate APY in TronSave
    • How to connect wallet in Tronsave?
    • Team of Service
  • 👨‍💻Full Code Example
    • Code Example (v2)
      • Buy Resource by API using private key
      • Buy Resources by API using api key
      • Extend order by API using api key
      • Extend order by API using private key
    • Code Example (v0)
      • Buy energy by API using private key
      • Buy energy by API using api key
      • Extend order by API using api key
Powered by GitBook
On this page
  1. DEVELOPER
  2. Rest API v0
  3. Buy on Rest API
  4. Use API Key

Get Internal Account Order History

PreviousGet one order detailsNextExtend with Rest API

Last updated 1 day ago

To use this feature, you must have the API key. Read to view how to get our API key

Get order history by API key

GET https://api.tronsave.io/v0/orders

Rate limit: 15 requests per 1 second

Get many orders sorted by creation time. Default: return 10 newest orders

Query Parameters

Name
Type
Description

page

Integer

start from 0. Default:0

pageSize

Integer

default: 10

{
   data:{
     id: string, // id of order
     requester: string, // the address represents for order owner
     target: string, // the address that is received resource 
     resource_amount: number, // the amount of resource
     resource_type: string, // the amount type is "ENERGY"
     remain_amount: number, // the remaining amount can matching by the system
     price: number, // price unit is equal to sun
     duration: number, // rent duration, duration unit is equal to second
     allow_partial_fill: boolean, //Allow the order to be filled partially or not
     payout_amount: number, // Total payout of this order
     fulfilled_percent: number, //The percent that shows filling processing. 0-100
     matched_delegates:{ //All matched delegate for this order
       delegator: string // The address that delegates resources for the target address
       amount: number //The amount of resource was delegated
       txid: number // The transaction id in on-chain 
     }[]
   } [],
   total:number
}

Example

{
  "apikey": <YOUR_API_KEY>
}
{
    "data": [
        {
            "id": "651d0e5d8248d002ea08a231",
            "requester": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
            "target": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
            "resource_amount": 100000,
            "resource_type": "ENERGY",
            "remain_amount": 100000,
            "price": 45,
            "duration": 259200,
            "allow_partial_fill": false,
            "payout_amount": 4500000,
            "fulfilled_percent": 100,
            "matched_delegates": [
                {
                    "delegator": "TKVSaJQDWeKFSEXmA44pjxduGTxy888888",
                    "amount": 100000,
                    "txid": "transaction_id_1"
                }
            ]
        },
        {
            "id": "651d2306e55c073f6ca0992e",
            "requester": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
            "target": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
            "resource_amount": 100000,
            "resource_type": "ENERGY",
            "remain_amount": 0,
            "price": 67.5,
            "duration": 3600,
            "allow_partial_fill": true,
            "payout_amount": 6750000,
            "fulfilled_percent": 100,
             "matched_delegates": [
                {
                    "delegator": "TKVSaJQDWeKFSEXmA44pjxduGTxy888888",
                    "amount": 100000,
                    "txid": "transaction_id_2"
                }
            ]
        }
    ],
    "total": 2
}

Example Code

const GetOrderHistory = async (api_key) => {
    const url = "https://api.tronsave.io/v0/orders"
    const data = await fetch(url, {
        headers: {
            'apikey': api_key
        }
    })
    const response = await data.json()
    /**
     * Example response
     * @link https://docs.tronsave.io/buy-energy-on-telegram/using-api-key-to/get-internal-account-order-history 
        {
            "data": [
                {
                    "id": "651d0e5d8248d002ea08a231",
                    "requester": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
                    "target": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
                    "resource_amount": 100000,
                    "resource_type": "ENERGY",
                    "remain_amount": 100000,
                    "price": 45,
                    "duration": 259200,
                    "allow_partial_fill": false,
                    "payout_amount": 4500000,
                    "fulfilled_percent": 100,
                    "matched_delegates": [
                        {
                            "delegator": "TKVSaJQDWeKFSEXmA44pjxduGTxy888888",
                            "amount": 100000,
                            "txid": "transaction_id_1"
                        }
                    ]
                },
                {
                    "id": "651d2306e55c073f6ca0992e",
                    "requester": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
                    "target": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
                    "resource_amount": 100000,
                    "resource_type": "ENERGY",
                    "remain_amount": 0,
                    "price": 67.5,
                    "duration": 3600,
                    "allow_partial_fill": true,
                    "payout_amount": 6750000,
                    "fulfilled_percent": 100,
                    "matched_delegates": [
                        {
                            "delegator": "TKVSaJQDWeKFSEXmA44pjxduGTxy888888",
                            "amount": 100000,
                            "txid": "transaction_id_2"
                        }
                    ]
                }
            ],
            "total": 2
        }
     */
    return response
}
curl --location 'https://api.tronsave.io/v0/orders' \
--header 'apikey: {{apikey}}'
here