Skip to content

List Basket

GET basket/listBasket

This API lets you see all the trading baskets you have. Each basket shows the trades inside it, its status (like executed, not executed, or all), and when it was created.

Parameters

NameTypeRequiredDescription
listTypestringtrueThe listType parameter defaults to 'ALL' if not specified. Valid values include 'ALL,' 'EXECUTED,' and 'NOT EXECUTED.'

Sample Code

bash
curl -X GET 'https://tradeapi.samco.in/basket/listBasket?listType=NOT EXECUTED' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-session-token: <SESSION_TOKEN>'
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Sample {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();

    HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://tradeapi.samco.in/basket/listBasket?listType=NOT EXECUTED"))
        .header("Content-Type", "application/json")
        .header("Accept", "application/json")
        .header("x-session-token", "<SESSION_TOKEN>")
        .GET()
        .build();

    HttpResponse<String> response =
        client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(response.body());
  }
}
js
(async () => {
  const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'x-session-token': '<SESSION_TOKEN>',
  };

  const response = await fetch('https://tradeapi.samco.in/basket/listBasket?listType=NOT EXECUTED', {
    method: 'GET',
    headers,
  });

  const data = await response.json();
  console.log(data);
})();
py
import requests
import json

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': '<SESSION_TOKEN>',
}

r = requests.get('https://tradeapi.samco.in/basket/listBasket?listType=NOT EXECUTED',
  headers=headers)

print(r.json())

Sample Responses

json
{
    "serverTime": "09/08/24 11:42:06",
    "msgId": "d27758a6-48b2-43d1-bbd0-6be6c1c75948",
    "status": "Success",
    "statusMessage": "List of Baskets fetched successfully",
    "basketList": [
        {
            "basketId": 64,
            "basketName": "NIFTY FO",
            "totalOrders": 0,
            "maxOrders": 100,
            "executedOrders": 0,
            "displayOrder": 63,
            "requiredMargin": "0.00",
            "finalMargin": "0.00",
            "isreArranged": false,
            "deletedContracts": 0,
            "createdAt": "2024-08-08 19:06:22",
            "updatedAt": "",
            "basketStatus": "NOT EXECUTED",
            "chronologicalView": true
        },
    ]
}
json
{
    "serverTime": "09/08/24 11:48:59",
    "status": "Failure",
    "validationErrors": [
        " Please enter a valid listType - ALL / EXECUTED / NOT EXECUTED "
    ]
}

Response Schema

Status Code 200

NameTypeDescription
serverTimestringTime at Server.
msgIdstringUnique identifier for every request. Please quote this identifier to the support team if you face issues with the API request.
statusstringStatus of the order cancellation request. Can be 'success' or 'failure'.
statusMessagestringStatus message for the order cancellation request.
basketListArray of ObjectsList of baskets with details about each basket.
basketIdstringUnique identifier for the basket.
basketNamestringThe name given to the basket, representing its purpose or content.
totalOrdersstringThe total number of orders currently placed within this basket.
maxOrdersstringThe maximum number of orders allowed in this basket.
executedOrdersstringThe number of orders within the basket that have been executed.
displayOrderstringThe order in which this basket should be displayed in the list. A lower number usually means higher priority.
requiredMarginstringThe margin required for the orders in this basket, in the account's currency.
finalMarginstringThe final margin calculated after considering the orders in the basket, also in the account's currency.
isreArrangedstringFlag indicating whether the orders in the basket have been rearranged (true) or not (false).
deletedContractsstringThe number of contracts that have been deleted from the basket.
createdAtstringThe date and time when the basket was created.
updatedAtstringThe date and time when the basket was last updated. This field is empty if the basket has not been updated since creation.
basketStatusstringThe current status of the basket, indicating whether it has been executed ("EXECUTED") or not ("NOT EXECUTED").
chronologicalViewstringIndicates whether the orders in the basket are displayed in chronological order (true) or not (false).