BSC REST API Specification for Brokers

Authentication

From the browser, the customer logs in to the BSC authentication service on the SSO server, if the login is successful for the first time, the customer will be asked to authenticate layer 2 password (according to the authentication method registered with BSC). After successful authentication, the partner will query for account information (order and position list, money and securities asset information, etc.) from the BSC server.

Authentication via server sso

All request are required addition the Authorization header (Bearer ) to authenticate the account.

Access-Token is a string granted to server application for each user, after having passed the username / pass authentication and authorization steps.

Steps to request Access-Token with response_type: Code

1. The server application requires authorization to access the BSC system through the user by redirecting to the url:

https://api.bsc.com.vn:1347/oauth/authorize?client_id=<client_id>&response_type=code&redirect_uri=<url_callback>&scope=<cac_scope_yeu_cau_duoc_uy_quyen>

List of authorized scopes:

  • { identify: 'account-read', description: This permission allows the app to read user account information' },
  • {identify: 'account-write', description: 'This permission allows the app to read and edit the user's account information'},
  • {identify: 'order-read', description: 'This permission allows the app to see the user's command book information'},
  • {identify: 'order-write', description: 'This permission allows the application to view information about the user's order book, which can be ordered on behalf of the user'},
  • {identify: 'balance-read', description: 'This permission allows the application to view information about the user's cash balance, securities balance'},
  • {identify: 'balance-write', description: 'This permission allows the application to view information about the user's cash balance, securities balance, and allow actions to change the balance of the account. user (Ex: transfer ...) '},
  • {identify: 'general', description: ‘Allow the app to have full permissions to manipulate users' accounts’}

Note: if multiple scopes are required, scopes are separated by spaces.

List of supported languages: vi, en

2. The user logs in and confirms that the server application has access to the required permissions.

3. The system will automatically redirect the User's browser to the url_callback link with the authorization code: ?code=JKASDCNWUYASK*****

4. The server application after receiving the authorization code then call the below restful api to receive Access-Token

POST: https://api.bsc.com.vn:1347/oauth/token

Params: client_id:<client_id>,
 client_secret : <client_secret>,
 grant_type : authorization_code,
 redirect_uri : <url_callback>,
 code : <Authorization_code_received>
 Response:{"access_token": "2TQSARo8P8DTfNSvQglCbv0P3Y7KiVgsTBN9******","refresh_token": "SADHFKLJASDJFAJJFSLJKXFA******","expired_time": "360000" }

Steps to request Access-Token with response_type: api_key

  • Create Api_Key
  • Use Api_Key to get Access-Token

Logout the sso server:

The server application sends a request to the browser to redirect to the Uri: https://api.bsc.com.vn:1347/oauth/logout

Refresh Token

  • When Access-Token is expired, server application can use Refresh Token to regain Access Token in the following way
  • call the restful api to get new Access-Token:
     POST: https://api.bsc.com.vn:1347/oauth/token
     Params: client_id:<client_id>,
     client_secret : <client_secret>,
     grant_type : refresh_token,
     refresh_token : <refresh token received>,
     Response:{"access_token": "2TQSARo8P8DTfNSvQglCbv0P3Y7KiVgsTBN9******","refresh_token": "SADHFKLJASDJFAJJFSLJKXFA******","expired_time": "360000" }

Account

accountsAccountIdExecutionsGet

Executions

Get the orders that were executed during the current session for the account. It is expected that broker returns orders filled/cancelled/rejected during current session.


/accounts/{accountId}/executions

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/accounts/{accountId}/executions?instrument=&maxCount="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccountApi;

import java.io.File;
import java.util.*;

public class AccountApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        String instrument = instrument_example; // String | Broker instrument name.
        BigDecimal maxCount = 1.2; // BigDecimal | Maximum count of executions to return.
        try {
            apiInstance.accountsAccountIdExecutionsGet(accountId, instrument, maxCount);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdExecutionsGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.AccountApi;

public class AccountApiExample {

    public static void main(String[] args) {
        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        String instrument = instrument_example; // String | Broker instrument name.
        BigDecimal maxCount = 1.2; // BigDecimal | Maximum count of executions to return.
        try {
            apiInstance.accountsAccountIdExecutionsGet(accountId, instrument, maxCount);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdExecutionsGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.
String *instrument = instrument_example; // Broker instrument name.
BigDecimal *maxCount = 1.2; // Maximum count of executions to return. (optional)

AccountApi *apiInstance = [[AccountApi alloc] init];

// Executions
[apiInstance accountsAccountIdExecutionsGetWith:accountId
    instrument:instrument
    maxCount:maxCount
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.AccountApi()
var accountId = accountId_example; // {{String}} Account identifier.
var instrument = instrument_example; // {{String}} Broker instrument name.
var opts = { 
  'maxCount': 1.2 // {{BigDecimal}} Maximum count of executions to return.
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdExecutionsGet(accountId, instrument, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdExecutionsGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountApi();
            var accountId = accountId_example;  // String | Account identifier.
            var instrument = instrument_example;  // String | Broker instrument name.
            var maxCount = 1.2;  // BigDecimal | Maximum count of executions to return. (optional) 

            try
            {
                // Executions
                apiInstance.accountsAccountIdExecutionsGet(accountId, instrument, maxCount);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountApi.accountsAccountIdExecutionsGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiAccountApi();
$accountId = accountId_example; // String | Account identifier.
$instrument = instrument_example; // String | Broker instrument name.
$maxCount = 1.2; // BigDecimal | Maximum count of executions to return.

try {
    $api_instance->accountsAccountIdExecutionsGet($accountId, $instrument, $maxCount);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountsAccountIdExecutionsGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccountApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::AccountApi->new();
my $accountId = accountId_example; # String | Account identifier.
my $instrument = instrument_example; # String | Broker instrument name.
my $maxCount = 1.2; # BigDecimal | Maximum count of executions to return.

eval { 
    $api_instance->accountsAccountIdExecutionsGet(accountId => $accountId, instrument => $instrument, maxCount => $maxCount);
};
if ($@) {
    warn "Exception when calling AccountApi->accountsAccountIdExecutionsGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.AccountApi()
accountId = accountId_example # String | Account identifier.
instrument = instrument_example # String | Broker instrument name.
maxCount = 1.2 # BigDecimal | Maximum count of executions to return. (optional)

try: 
    # Executions
    api_instance.accounts_account_id_executions_get(accountId, instrument, maxCount=maxCount)
except ApiException as e:
    print("Exception when calling AccountApi->accountsAccountIdExecutionsGet: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required
Query parameters
Name Description
instrument*
String
Broker instrument name.
Required
maxCount
BigDecimal
Maximum count of executions to return.

Responses

Status: 200 - response

{
  "s": "ok",
  "d": [
    {
      "id": "EX34567",
      "instrument": "EURUSD",
      "price": 1.23564,
      "time": 1548406235,
      "qty": 1,
      "side": "buy"
    }
  ]
}

accountsAccountIdInstrumentsGet

Instruments

Get the list of the instruments that are available for trading with the specified account.


/accounts/{accountId}/instruments

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/accounts/{accountId}/instruments"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccountApi;

import java.io.File;
import java.util.*;

public class AccountApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdInstrumentsGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdInstrumentsGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.AccountApi;

public class AccountApiExample {

    public static void main(String[] args) {
        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdInstrumentsGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdInstrumentsGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.

AccountApi *apiInstance = [[AccountApi alloc] init];

// Instruments
[apiInstance accountsAccountIdInstrumentsGetWith:accountId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.AccountApi()
var accountId = accountId_example; // {{String}} Account identifier.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdInstrumentsGet(accountId, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdInstrumentsGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountApi();
            var accountId = accountId_example;  // String | Account identifier.

            try
            {
                // Instruments
                apiInstance.accountsAccountIdInstrumentsGet(accountId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountApi.accountsAccountIdInstrumentsGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiAccountApi();
$accountId = accountId_example; // String | Account identifier.

try {
    $api_instance->accountsAccountIdInstrumentsGet($accountId);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountsAccountIdInstrumentsGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccountApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::AccountApi->new();
my $accountId = accountId_example; # String | Account identifier.

eval { 
    $api_instance->accountsAccountIdInstrumentsGet(accountId => $accountId);
};
if ($@) {
    warn "Exception when calling AccountApi->accountsAccountIdInstrumentsGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.AccountApi()
accountId = accountId_example # String | Account identifier.

try: 
    # Instruments
    api_instance.accounts_account_id_instruments_get(accountId)
except ApiException as e:
    print("Exception when calling AccountApi->accountsAccountIdInstrumentsGet: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required

Responses

Status: 200 - response

{
  "s": "ok",
  "d": [
    {
      "name": "EURUSD",
      "description": "EUR/USD ",
      "minQty": 1,
      "maxQty": 100000000,
      "qtyStep": 100,
      "pipSize": 0.0001,
      "pipValue": 0.00008845,
      "minTick": 0.00001,
      "type": "forex"
    },
    {
      "name": "AAPLE",
      "description": "Apple Inc",
      "minQty": 1,
      "maxQty": 100000000,
      "qtyStep": 1,
      "pipSize": 0.01,
      "pipValue": 1,
      "minTick": 0.01,
      "type": "stock"
    }
  ]
}

accountsAccountIdOrdersGet

Orders

Get current session orders for the account. It is expected that broker returns orders filled/cancelled/rejected during current session.


/accounts/{accountId}/orders

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/accounts/{accountId}/orders"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccountApi;

import java.io.File;
import java.util.*;

public class AccountApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdOrdersGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdOrdersGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.AccountApi;

public class AccountApiExample {

    public static void main(String[] args) {
        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdOrdersGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdOrdersGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.

AccountApi *apiInstance = [[AccountApi alloc] init];

// Orders
[apiInstance accountsAccountIdOrdersGetWith:accountId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.AccountApi()
var accountId = accountId_example; // {{String}} Account identifier.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdOrdersGet(accountId, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdOrdersGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountApi();
            var accountId = accountId_example;  // String | Account identifier.

            try
            {
                // Orders
                apiInstance.accountsAccountIdOrdersGet(accountId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountApi.accountsAccountIdOrdersGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiAccountApi();
$accountId = accountId_example; // String | Account identifier.

try {
    $api_instance->accountsAccountIdOrdersGet($accountId);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountsAccountIdOrdersGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccountApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::AccountApi->new();
my $accountId = accountId_example; # String | Account identifier.

eval { 
    $api_instance->accountsAccountIdOrdersGet(accountId => $accountId);
};
if ($@) {
    warn "Exception when calling AccountApi->accountsAccountIdOrdersGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.AccountApi()
accountId = accountId_example # String | Account identifier.

try: 
    # Orders
    api_instance.accounts_account_id_orders_get(accountId)
except ApiException as e:
    print("Exception when calling AccountApi->accountsAccountIdOrdersGet: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required

Responses

Status: 200 - response

{
  "s": "ok",
  "d": [
    {
      "id": "1",
      "instrument": "EURUSD",
      "qty": 100,
      "side": "buy",
      "type": "limit",
      "avgPrice": 0,
      "limitPrice": 1.14344,
      "duration": {
        "type": "gtt",
        "datetime": 1548406235
      },
      "status": "working"
    },
    {
      "id": "2",
      "instrument": "EURUSD",
      "qty": 100,
      "side": "sell",
      "type": "limit",
      "filledQty": 50,
      "avgPrice": 0,
      "limitPrice": 1.15094,
      "parentId": "1",
      "parentType": "order",
      "duration": {
        "type": "gtt",
        "datetime": 1548406235
      },
      "status": "inactive"
    }
  ]
}

accountsAccountIdOrdersHistoryGet

Orders History

Get order history for an account. It is expected that returned orders will have a final status (`rejected`, `filled`, `cancelled`). This endpoint is optional. If you don't support orders history, please set `AccountFlags::supportOrdersHistory` to `false`.


/accounts/{accountId}/ordersHistory

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/accounts/{accountId}/ordersHistory?maxCount="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccountApi;

import java.io.File;
import java.util.*;

public class AccountApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        BigDecimal maxCount = 1.2; // BigDecimal | Maximum count of orders to return.
        try {
            apiInstance.accountsAccountIdOrdersHistoryGet(accountId, maxCount);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdOrdersHistoryGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.AccountApi;

public class AccountApiExample {

    public static void main(String[] args) {
        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        BigDecimal maxCount = 1.2; // BigDecimal | Maximum count of orders to return.
        try {
            apiInstance.accountsAccountIdOrdersHistoryGet(accountId, maxCount);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdOrdersHistoryGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.
BigDecimal *maxCount = 1.2; // Maximum count of orders to return. (optional)

AccountApi *apiInstance = [[AccountApi alloc] init];

// Orders History
[apiInstance accountsAccountIdOrdersHistoryGetWith:accountId
    maxCount:maxCount
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.AccountApi()
var accountId = accountId_example; // {{String}} Account identifier.
var opts = { 
  'maxCount': 1.2 // {{BigDecimal}} Maximum count of orders to return.
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdOrdersHistoryGet(accountId, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdOrdersHistoryGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountApi();
            var accountId = accountId_example;  // String | Account identifier.
            var maxCount = 1.2;  // BigDecimal | Maximum count of orders to return. (optional) 

            try
            {
                // Orders History
                apiInstance.accountsAccountIdOrdersHistoryGet(accountId, maxCount);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountApi.accountsAccountIdOrdersHistoryGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiAccountApi();
$accountId = accountId_example; // String | Account identifier.
$maxCount = 1.2; // BigDecimal | Maximum count of orders to return.

try {
    $api_instance->accountsAccountIdOrdersHistoryGet($accountId, $maxCount);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountsAccountIdOrdersHistoryGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccountApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::AccountApi->new();
my $accountId = accountId_example; # String | Account identifier.
my $maxCount = 1.2; # BigDecimal | Maximum count of orders to return.

eval { 
    $api_instance->accountsAccountIdOrdersHistoryGet(accountId => $accountId, maxCount => $maxCount);
};
if ($@) {
    warn "Exception when calling AccountApi->accountsAccountIdOrdersHistoryGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.AccountApi()
accountId = accountId_example # String | Account identifier.
maxCount = 1.2 # BigDecimal | Maximum count of orders to return. (optional)

try: 
    # Orders History
    api_instance.accounts_account_id_orders_history_get(accountId, maxCount=maxCount)
except ApiException as e:
    print("Exception when calling AccountApi->accountsAccountIdOrdersHistoryGet: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required
Query parameters
Name Description
maxCount
BigDecimal
Maximum count of orders to return.

Responses

Status: 200 - response

{
  "s": "ok",
  "d": [
    {
      "id": "1",
      "instrument": "EURUSD",
      "qty": 100,
      "side": "buy",
      "type": "limit",
      "avgPrice": 0,
      "limitPrice": 1.14344,
      "duration": {
        "type": "gtt",
        "datetime": 1548406235
      },
      "status": "filled"
    },
    {
      "id": "2",
      "instrument": "EURUSD",
      "qty": 100,
      "side": "sell",
      "type": "limit",
      "filledQty": 50,
      "avgPrice": 0,
      "limitPrice": 1.15094,
      "parentId": "1",
      "parentType": "order",
      "duration": {
        "type": "gtt",
        "datetime": 1548406235
      },
      "status": "cancelled"
    }
  ]
}

accountsAccountIdPermissionsGet

Permissions

Get a list of symbol groups allowed for the user. It is only required if you use groups of symbols to restrict access to instrument's data.


/accounts/{accountId}/permissions

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/accounts/{accountId}/permissions"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccountApi;

import java.io.File;
import java.util.*;

public class AccountApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdPermissionsGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdPermissionsGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.AccountApi;

public class AccountApiExample {

    public static void main(String[] args) {
        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdPermissionsGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdPermissionsGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.

AccountApi *apiInstance = [[AccountApi alloc] init];

// Permissions
[apiInstance accountsAccountIdPermissionsGetWith:accountId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.AccountApi()
var accountId = accountId_example; // {{String}} Account identifier.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdPermissionsGet(accountId, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdPermissionsGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountApi();
            var accountId = accountId_example;  // String | Account identifier.

            try
            {
                // Permissions
                apiInstance.accountsAccountIdPermissionsGet(accountId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountApi.accountsAccountIdPermissionsGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiAccountApi();
$accountId = accountId_example; // String | Account identifier.

try {
    $api_instance->accountsAccountIdPermissionsGet($accountId);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountsAccountIdPermissionsGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccountApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::AccountApi->new();
my $accountId = accountId_example; # String | Account identifier.

eval { 
    $api_instance->accountsAccountIdPermissionsGet(accountId => $accountId);
};
if ($@) {
    warn "Exception when calling AccountApi->accountsAccountIdPermissionsGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.AccountApi()
accountId = accountId_example # String | Account identifier.

try: 
    # Permissions
    api_instance.accounts_account_id_permissions_get(accountId)
except ApiException as e:
    print("Exception when calling AccountApi->accountsAccountIdPermissionsGet: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required

Responses

Status: 200 - response

{
  "s": "ok",
  "d": [
    {
      "groups": [
        "broker_stocks"
      ]
    }
  ]
}

accountsAccountIdPositionsGet

Positions

Get positions for an account.


/accounts/{accountId}/positions

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/accounts/{accountId}/positions"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccountApi;

import java.io.File;
import java.util.*;

public class AccountApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdPositionsGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdPositionsGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.AccountApi;

public class AccountApiExample {

    public static void main(String[] args) {
        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdPositionsGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdPositionsGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.

AccountApi *apiInstance = [[AccountApi alloc] init];

// Positions
[apiInstance accountsAccountIdPositionsGetWith:accountId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.AccountApi()
var accountId = accountId_example; // {{String}} Account identifier.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdPositionsGet(accountId, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdPositionsGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountApi();
            var accountId = accountId_example;  // String | Account identifier.

            try
            {
                // Positions
                apiInstance.accountsAccountIdPositionsGet(accountId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountApi.accountsAccountIdPositionsGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiAccountApi();
$accountId = accountId_example; // String | Account identifier.

try {
    $api_instance->accountsAccountIdPositionsGet($accountId);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountsAccountIdPositionsGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccountApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::AccountApi->new();
my $accountId = accountId_example; # String | Account identifier.

eval { 
    $api_instance->accountsAccountIdPositionsGet(accountId => $accountId);
};
if ($@) {
    warn "Exception when calling AccountApi->accountsAccountIdPositionsGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.AccountApi()
accountId = accountId_example # String | Account identifier.

try: 
    # Positions
    api_instance.accounts_account_id_positions_get(accountId)
except ApiException as e:
    print("Exception when calling AccountApi->accountsAccountIdPositionsGet: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required

Responses

Status: 200 - response

{
  "s": "ok",
  "d": [
    {
      "id": "1",
      "instrument": "EURUSD",
      "qty": 1,
      "side": "buy",
      "avgPrice": 1.1347091,
      "unrealizedPl": 19.4739
    }
  ]
}

accountsAccountIdStateGet

State

Get account information.


/accounts/{accountId}/state

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/accounts/{accountId}/state?locale="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccountApi;

import java.io.File;
import java.util.*;

public class AccountApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        String locale = locale_example; // String | Locale (language) id.
        try {
            apiInstance.accountsAccountIdStateGet(accountId, locale);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdStateGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.AccountApi;

public class AccountApiExample {

    public static void main(String[] args) {
        AccountApi apiInstance = new AccountApi();
        String accountId = accountId_example; // String | Account identifier.
        String locale = locale_example; // String | Locale (language) id.
        try {
            apiInstance.accountsAccountIdStateGet(accountId, locale);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsAccountIdStateGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.
String *locale = locale_example; // Locale (language) id.

AccountApi *apiInstance = [[AccountApi alloc] init];

// State
[apiInstance accountsAccountIdStateGetWith:accountId
    locale:locale
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.AccountApi()
var accountId = accountId_example; // {{String}} Account identifier.
var locale = locale_example; // {{String}} Locale (language) id.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdStateGet(accountId, locale, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdStateGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountApi();
            var accountId = accountId_example;  // String | Account identifier.
            var locale = locale_example;  // String | Locale (language) id.

            try
            {
                // State
                apiInstance.accountsAccountIdStateGet(accountId, locale);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountApi.accountsAccountIdStateGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiAccountApi();
$accountId = accountId_example; // String | Account identifier.
$locale = locale_example; // String | Locale (language) id.

try {
    $api_instance->accountsAccountIdStateGet($accountId, $locale);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountsAccountIdStateGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccountApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::AccountApi->new();
my $accountId = accountId_example; # String | Account identifier.
my $locale = locale_example; # String | Locale (language) id.

eval { 
    $api_instance->accountsAccountIdStateGet(accountId => $accountId, locale => $locale);
};
if ($@) {
    warn "Exception when calling AccountApi->accountsAccountIdStateGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.AccountApi()
accountId = accountId_example # String | Account identifier.
locale = locale_example # String | Locale (language) id.

try: 
    # State
    api_instance.accounts_account_id_state_get(accountId, locale)
except ApiException as e:
    print("Exception when calling AccountApi->accountsAccountIdStateGet: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required
Query parameters
Name Description
locale*
String
Locale (language) id.
Required

Responses

Status: 200 - response

{
  "s": "ok",
  "d": {
    "balance": 41757.91,
    "unrealizedPl": 1053.02,
    "equity": 42857.56,
    "amData": [
      [
        [
          "90.22",
          "42857.56",
          "42857.56",
          "1099.65",
          "0.00",
          "41757.91"
        ]
      ]
    ]
  }
}

accountsGet

Accounts

Get a list of accounts owned by the user.


/accounts

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/accounts"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.AccountApi;

import java.io.File;
import java.util.*;

public class AccountApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        AccountApi apiInstance = new AccountApi();
        try {
            apiInstance.accountsGet();
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.AccountApi;

public class AccountApiExample {

    public static void main(String[] args) {
        AccountApi apiInstance = new AccountApi();
        try {
            apiInstance.accountsGet();
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountsGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

AccountApi *apiInstance = [[AccountApi alloc] init];

// Accounts
[apiInstance accountsGetWithCompletionHandler: 
              ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.AccountApi()
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsGet(callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountApi();

            try
            {
                // Accounts
                apiInstance.accountsGet();
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountApi.accountsGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiAccountApi();

try {
    $api_instance->accountsGet();
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountsGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccountApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::AccountApi->new();

eval { 
    $api_instance->accountsGet();
};
if ($@) {
    warn "Exception when calling AccountApi->accountsGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.AccountApi()

try: 
    # Accounts
    api_instance.accounts_get()
except ApiException as e:
    print("Exception when calling AccountApi->accountsGet: %s\n" % e)

Parameters

Responses

Status: 200 - response

{
  "s": "ok",
  "d": [
    {
      "id": "ACC-001",
      "name": "Demo trading account",
      "currency": "JPY",
      "currencySign": "¥",
      "config": {
        "showQuantityInsteadOfAmount": true,
        "supportDOM": true,
        "supportOrderBrackets": true,
        "supportPositionBrackets": true,
        "supportClosePosition": true,
        "supportEditAmount": true,
        "supportLevel2Data": true,
        "supportMultiposition": true,
        "supportPLUpdate": true,
        "supportReducePosition": true,
        "supportStopLimitOrders": true,
        "supportOrdersHistory": true,
        "supportExecutions": true,
        "supportDigitalSignature": true,
        "supportBalances": true
      }
    }
  ]
}

BrokerConfiguration

configGet

Configuration

Get localized configuration.


/config

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/config?locale="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.BrokerConfigurationApi;

import java.io.File;
import java.util.*;

public class BrokerConfigurationApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        BrokerConfigurationApi apiInstance = new BrokerConfigurationApi();
        String locale = locale_example; // String | Locale (language) id.
        try {
            ConfigResponse result = apiInstance.configGet(locale);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BrokerConfigurationApi#configGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.BrokerConfigurationApi;

public class BrokerConfigurationApiExample {

    public static void main(String[] args) {
        BrokerConfigurationApi apiInstance = new BrokerConfigurationApi();
        String locale = locale_example; // String | Locale (language) id.
        try {
            ConfigResponse result = apiInstance.configGet(locale);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BrokerConfigurationApi#configGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *locale = locale_example; // Locale (language) id.

BrokerConfigurationApi *apiInstance = [[BrokerConfigurationApi alloc] init];

// Configuration
[apiInstance configGetWith:locale
              completionHandler: ^(ConfigResponse output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.BrokerConfigurationApi()
var locale = locale_example; // {{String}} Locale (language) id.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.configGet(locale, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class configGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new BrokerConfigurationApi();
            var locale = locale_example;  // String | Locale (language) id.

            try
            {
                // Configuration
                ConfigResponse result = apiInstance.configGet(locale);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling BrokerConfigurationApi.configGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiBrokerConfigurationApi();
$locale = locale_example; // String | Locale (language) id.

try {
    $result = $api_instance->configGet($locale);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BrokerConfigurationApi->configGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::BrokerConfigurationApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::BrokerConfigurationApi->new();
my $locale = locale_example; # String | Locale (language) id.

eval { 
    my $result = $api_instance->configGet(locale => $locale);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling BrokerConfigurationApi->configGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.BrokerConfigurationApi()
locale = locale_example # String | Locale (language) id.

try: 
    # Configuration
    api_response = api_instance.config_get(locale)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling BrokerConfigurationApi->configGet: %s\n" % e)

Parameters

Query parameters
Name Description
locale*
String
Locale (language) id.
Required

Responses

Status: 200 - response

{
  "s": "ok",
  "d": {
    "accountManager": [
      {
        "id": "accountSummary",
        "title": "",
        "columns": [
          {
            "id": "todayPL",
            "title": "Today's P&L"
          },
          {
            "id": "accountValue",
            "title": "Account Value"
          },
          {
            "id": "balance",
            "title": "Balance"
          },
          {
            "id": "totalMargin",
            "title": "Margin"
          },
          {
            "id": "held",
            "title": "Held"
          },
          {
            "id": "buyingPower",
            "title": "Buying Power"
          }
        ]
      }
    ],
    "durations": [
      {
        "id": "GTT",
        "title": "Good Till Time",
        "hasDatePicker": true,
        "hasTimePicker": true
      }
    ],
    "pullingInterval": {
      "history": 300,
      "quotes": 3000,
      "orders": 300,
      "positions": 300,
      "accountManager": 300
    }
  }
}

mappingGet

Mapping

Return all broker instruments with corresponding BSC instruments. It is required to add a Broker to BSC.com. Please note that this endpoint works without authorization!


/mapping

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/mapping"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.BrokerConfigurationApi;

import java.io.File;
import java.util.*;

public class BrokerConfigurationApiExample {

    public static void main(String[] args) {
        
        BrokerConfigurationApi apiInstance = new BrokerConfigurationApi();
        try {
            MappingResponse result = apiInstance.mappingGet();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BrokerConfigurationApi#mappingGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.BrokerConfigurationApi;

public class BrokerConfigurationApiExample {

    public static void main(String[] args) {
        BrokerConfigurationApi apiInstance = new BrokerConfigurationApi();
        try {
            MappingResponse result = apiInstance.mappingGet();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BrokerConfigurationApi#mappingGet");
            e.printStackTrace();
        }
    }
}

BrokerConfigurationApi *apiInstance = [[BrokerConfigurationApi alloc] init];

// Mapping
[apiInstance mappingGetWithCompletionHandler: 
              ^(MappingResponse output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');

var api = new BscRestApiSpecificationForBrokers.BrokerConfigurationApi()
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.mappingGet(callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class mappingGetExample
    {
        public void main()
        {

            var apiInstance = new BrokerConfigurationApi();

            try
            {
                // Mapping
                MappingResponse result = apiInstance.mappingGet();
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling BrokerConfigurationApi.mappingGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\ApiBrokerConfigurationApi();

try {
    $result = $api_instance->mappingGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BrokerConfigurationApi->mappingGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::BrokerConfigurationApi;

my $api_instance = WWW::SwaggerClient::BrokerConfigurationApi->new();

eval { 
    my $result = $api_instance->mappingGet();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling BrokerConfigurationApi->mappingGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.BrokerConfigurationApi()

try: 
    # Mapping
    api_response = api_instance.mapping_get()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling BrokerConfigurationApi->mappingGet: %s\n" % e)

Parameters

Responses

Status: 200 - response

{
  "s": "ok",
  "d": {
    "symbols": [
      {
        "f": [
          "EURUSD"
        ],
        "s": "FX_IDC:EURUSD"
      },
      {
        "f": [
          "AAPLE"
        ],
        "s": "NASDAQ:AAPLE"
      }
    ],
    "fields": [
      "brokerSymbol"
    ]
  }
}

CryptoBalances

accountsAccountIdBalancesGet

Balances

Return all balances for the user account. Used for crypto currencies only.


/accounts/{accountId}/balances

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/accounts/{accountId}/balances"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CryptoBalancesApi;

import java.io.File;
import java.util.*;

public class CryptoBalancesApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        CryptoBalancesApi apiInstance = new CryptoBalancesApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdBalancesGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling CryptoBalancesApi#accountsAccountIdBalancesGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CryptoBalancesApi;

public class CryptoBalancesApiExample {

    public static void main(String[] args) {
        CryptoBalancesApi apiInstance = new CryptoBalancesApi();
        String accountId = accountId_example; // String | Account identifier.
        try {
            apiInstance.accountsAccountIdBalancesGet(accountId);
        } catch (ApiException e) {
            System.err.println("Exception when calling CryptoBalancesApi#accountsAccountIdBalancesGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.

CryptoBalancesApi *apiInstance = [[CryptoBalancesApi alloc] init];

// Balances
[apiInstance accountsAccountIdBalancesGetWith:accountId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.CryptoBalancesApi()
var accountId = accountId_example; // {{String}} Account identifier.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdBalancesGet(accountId, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdBalancesGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new CryptoBalancesApi();
            var accountId = accountId_example;  // String | Account identifier.

            try
            {
                // Balances
                apiInstance.accountsAccountIdBalancesGet(accountId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CryptoBalancesApi.accountsAccountIdBalancesGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiCryptoBalancesApi();
$accountId = accountId_example; // String | Account identifier.

try {
    $api_instance->accountsAccountIdBalancesGet($accountId);
} catch (Exception $e) {
    echo 'Exception when calling CryptoBalancesApi->accountsAccountIdBalancesGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CryptoBalancesApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::CryptoBalancesApi->new();
my $accountId = accountId_example; # String | Account identifier.

eval { 
    $api_instance->accountsAccountIdBalancesGet(accountId => $accountId);
};
if ($@) {
    warn "Exception when calling CryptoBalancesApi->accountsAccountIdBalancesGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.CryptoBalancesApi()
accountId = accountId_example # String | Account identifier.

try: 
    # Balances
    api_instance.accounts_account_id_balances_get(accountId)
except ApiException as e:
    print("Exception when calling CryptoBalancesApi->accountsAccountIdBalancesGet: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required

Responses

Status: 200 - response

{
  "s": "ok",
  "d": [
    {
      "symbol": "BTC",
      "longName": "Bitcoin",
      "total": 1000,
      "available": 10,
      "btcValue": 1000
    }
  ]
}

DataIntegration

groupsGet

Groups

Get a list of possible groups of symbols. A group is a set of symbols that share a common access level. Any user can have access to any number of such groups. **IMPORTANT:** Please plan your symbol grouping carefully. Groups cannot be deleted, you can only remove all the symbols from there. **LIMITATIONS:** Each integration is limited to have up to 10 symbol groups. Each symbol group is limited to have up to 10K symbols in it. You cannot put the same symbol into 2 different groups. This endpoint allows you to specify a list of groups, and the [/permissions](#operation/getPermissions) endpoint specifies which groups are available for the certain user. When BSC user logs into his broker account - he will gain access to one or more groups, depending on the [/permissions](#operation/getPermissions) endpoint. At the [/symbol_info](#operation/getSymbolInfo) endpoint BSC adds the GET argument `group` with the name of the group. Thus, BSC will receive information about which group each symbol belongs to. It is required only if you use groups of symbols in order to restrict access to the instrument's data.


/groups

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/groups"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataIntegrationApi;

import java.io.File;
import java.util.*;

public class DataIntegrationApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();


        // Configure OAuth2 access token for authorization: ServerOAuth2Bearer
        OAuth ServerOAuth2Bearer = (OAuth) defaultClient.getAuthentication("ServerOAuth2Bearer");
        ServerOAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");

        DataIntegrationApi apiInstance = new DataIntegrationApi();
        try {
            apiInstance.groupsGet();
        } catch (ApiException e) {
            System.err.println("Exception when calling DataIntegrationApi#groupsGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.DataIntegrationApi;

public class DataIntegrationApiExample {

    public static void main(String[] args) {
        DataIntegrationApi apiInstance = new DataIntegrationApi();
        try {
            apiInstance.groupsGet();
        } catch (ApiException e) {
            System.err.println("Exception when calling DataIntegrationApi#groupsGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: ServerOAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

DataIntegrationApi *apiInstance = [[DataIntegrationApi alloc] init];

// Groups
[apiInstance groupsGetWithCompletionHandler: 
              ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;


// Configure OAuth2 access token for authorization: ServerOAuth2Bearer
var ServerOAuth2Bearer = defaultClient.authentications['ServerOAuth2Bearer'];
ServerOAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"

var api = new BscRestApiSpecificationForBrokers.DataIntegrationApi()
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.groupsGet(callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class groupsGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: ServerOAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new DataIntegrationApi();

            try
            {
                // Groups
                apiInstance.groupsGet();
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling DataIntegrationApi.groupsGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: ServerOAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiDataIntegrationApi();

try {
    $api_instance->groupsGet();
} catch (Exception $e) {
    echo 'Exception when calling DataIntegrationApi->groupsGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::DataIntegrationApi;

# Configure OAuth2 access token for authorization: ServerOAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::DataIntegrationApi->new();

eval { 
    $api_instance->groupsGet();
};
if ($@) {
    warn "Exception when calling DataIntegrationApi->groupsGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: ServerOAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.DataIntegrationApi()

try: 
    # Groups
    api_instance.groups_get()
except ApiException as e:
    print("Exception when calling DataIntegrationApi->groupsGet: %s\n" % e)

Parameters

Responses

Status: 200 - response

{
  "s": "ok",
  "d": {
    "groups": [
      {"id": "broker_stocks"},
      {"id": "broker_forex"}
    ]
  }
}

historyGet

History

Request for history bars. Each property of the response object is treated as a table column. Bar time for daily bars should be 00:00 UTC and is expected to be a trading day (not a day when the session starts). Bar time for monthly bars should be 00:00 UTC and is the first trading day of the month. If there is no data in the requested time period but there is data in the previous time period you should set the status code to `no_data` and the `nb` property to UNIX timestamp of the next available bar behind the range. If there is no data in the requested and previous time periods then you should set the status code to `no_data`.


/history

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/history?symbol=&resolution=&from=&to=&countback="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataIntegrationApi;

import java.io.File;
import java.util.*;

public class DataIntegrationApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();


        // Configure OAuth2 access token for authorization: ServerOAuth2Bearer
        OAuth ServerOAuth2Bearer = (OAuth) defaultClient.getAuthentication("ServerOAuth2Bearer");
        ServerOAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");

        DataIntegrationApi apiInstance = new DataIntegrationApi();
        String symbol = symbol_example; // String | Symbol name or ticker.
        String resolution = resolution_example; // String | Symbol resolution. Possible resolutions are daily (`D` or `1D`, `2D` ... ),
weekly (`1W`, `2W` ...), monthly (`1M`, `2M`...) and an intra-day
resolution – minutes(`1`, `2` ...).

        BigDecimal from = 1.2; // BigDecimal | Unix timestamp (UTC) of the leftmost required bar, including `from`.
        BigDecimal to = 1.2; // BigDecimal | Unix timestamp (UTC) of the rightmost required bar, including `to`. It can be in the future.
In this case, the rightmost required bar is the latest available bar.

        BigDecimal countback = 1.2; // BigDecimal | Number of bars (higher priority than `from`) starting with `to`. If
`countback` is set, `from` should be ignored.

        try {
            apiInstance.historyGet(symbol, resolution, from, to, countback);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataIntegrationApi#historyGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.DataIntegrationApi;

public class DataIntegrationApiExample {

    public static void main(String[] args) {
        DataIntegrationApi apiInstance = new DataIntegrationApi();
        String symbol = symbol_example; // String | Symbol name or ticker.
        String resolution = resolution_example; // String | Symbol resolution. Possible resolutions are daily (`D` or `1D`, `2D` ... ),
weekly (`1W`, `2W` ...), monthly (`1M`, `2M`...) and an intra-day
resolution – minutes(`1`, `2` ...).

        BigDecimal from = 1.2; // BigDecimal | Unix timestamp (UTC) of the leftmost required bar, including `from`.
        BigDecimal to = 1.2; // BigDecimal | Unix timestamp (UTC) of the rightmost required bar, including `to`. It can be in the future.
In this case, the rightmost required bar is the latest available bar.

        BigDecimal countback = 1.2; // BigDecimal | Number of bars (higher priority than `from`) starting with `to`. If
`countback` is set, `from` should be ignored.

        try {
            apiInstance.historyGet(symbol, resolution, from, to, countback);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataIntegrationApi#historyGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: ServerOAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *symbol = symbol_example; // Symbol name or ticker.
String *resolution = resolution_example; // Symbol resolution. Possible resolutions are daily (`D` or `1D`, `2D` ... ),
weekly (`1W`, `2W` ...), monthly (`1M`, `2M`...) and an intra-day
resolution – minutes(`1`, `2` ...).

BigDecimal *from = 1.2; // Unix timestamp (UTC) of the leftmost required bar, including `from`.
BigDecimal *to = 1.2; // Unix timestamp (UTC) of the rightmost required bar, including `to`. It can be in the future.
In this case, the rightmost required bar is the latest available bar.

BigDecimal *countback = 1.2; // Number of bars (higher priority than `from`) starting with `to`. If
`countback` is set, `from` should be ignored.
 (optional)

DataIntegrationApi *apiInstance = [[DataIntegrationApi alloc] init];

// History
[apiInstance historyGetWith:symbol
    resolution:resolution
    from:from
    to:to
    countback:countback
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;


// Configure OAuth2 access token for authorization: ServerOAuth2Bearer
var ServerOAuth2Bearer = defaultClient.authentications['ServerOAuth2Bearer'];
ServerOAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"

var api = new BscRestApiSpecificationForBrokers.DataIntegrationApi()
var symbol = symbol_example; // {{String}} Symbol name or ticker.
var resolution = resolution_example; // {{String}} Symbol resolution. Possible resolutions are daily (`D` or `1D`, `2D` ... ),
weekly (`1W`, `2W` ...), monthly (`1M`, `2M`...) and an intra-day
resolution – minutes(`1`, `2` ...).

var from = 1.2; // {{BigDecimal}} Unix timestamp (UTC) of the leftmost required bar, including `from`.
var to = 1.2; // {{BigDecimal}} Unix timestamp (UTC) of the rightmost required bar, including `to`. It can be in the future.
In this case, the rightmost required bar is the latest available bar.

var opts = { 
  'countback': 1.2 // {{BigDecimal}} Number of bars (higher priority than `from`) starting with `to`. If
`countback` is set, `from` should be ignored.

};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.historyGet(symbol, resolution, from, to, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class historyGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: ServerOAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new DataIntegrationApi();
            var symbol = symbol_example;  // String | Symbol name or ticker.
            var resolution = resolution_example;  // String | Symbol resolution. Possible resolutions are daily (`D` or `1D`, `2D` ... ),
weekly (`1W`, `2W` ...), monthly (`1M`, `2M`...) and an intra-day
resolution – minutes(`1`, `2` ...).

            var from = 1.2;  // BigDecimal | Unix timestamp (UTC) of the leftmost required bar, including `from`.
            var to = 1.2;  // BigDecimal | Unix timestamp (UTC) of the rightmost required bar, including `to`. It can be in the future.
In this case, the rightmost required bar is the latest available bar.

            var countback = 1.2;  // BigDecimal | Number of bars (higher priority than `from`) starting with `to`. If
`countback` is set, `from` should be ignored.
 (optional) 

            try
            {
                // History
                apiInstance.historyGet(symbol, resolution, from, to, countback);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling DataIntegrationApi.historyGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: ServerOAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiDataIntegrationApi();
$symbol = symbol_example; // String | Symbol name or ticker.
$resolution = resolution_example; // String | Symbol resolution. Possible resolutions are daily (`D` or `1D`, `2D` ... ),
weekly (`1W`, `2W` ...), monthly (`1M`, `2M`...) and an intra-day
resolution – minutes(`1`, `2` ...).

$from = 1.2; // BigDecimal | Unix timestamp (UTC) of the leftmost required bar, including `from`.
$to = 1.2; // BigDecimal | Unix timestamp (UTC) of the rightmost required bar, including `to`. It can be in the future.
In this case, the rightmost required bar is the latest available bar.

$countback = 1.2; // BigDecimal | Number of bars (higher priority than `from`) starting with `to`. If
`countback` is set, `from` should be ignored.


try {
    $api_instance->historyGet($symbol, $resolution, $from, $to, $countback);
} catch (Exception $e) {
    echo 'Exception when calling DataIntegrationApi->historyGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::DataIntegrationApi;

# Configure OAuth2 access token for authorization: ServerOAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::DataIntegrationApi->new();
my $symbol = symbol_example; # String | Symbol name or ticker.
my $resolution = resolution_example; # String | Symbol resolution. Possible resolutions are daily (`D` or `1D`, `2D` ... ),
weekly (`1W`, `2W` ...), monthly (`1M`, `2M`...) and an intra-day
resolution – minutes(`1`, `2` ...).

my $from = 1.2; # BigDecimal | Unix timestamp (UTC) of the leftmost required bar, including `from`.
my $to = 1.2; # BigDecimal | Unix timestamp (UTC) of the rightmost required bar, including `to`. It can be in the future.
In this case, the rightmost required bar is the latest available bar.

my $countback = 1.2; # BigDecimal | Number of bars (higher priority than `from`) starting with `to`. If
`countback` is set, `from` should be ignored.


eval { 
    $api_instance->historyGet(symbol => $symbol, resolution => $resolution, from => $from, to => $to, countback => $countback);
};
if ($@) {
    warn "Exception when calling DataIntegrationApi->historyGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: ServerOAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.DataIntegrationApi()
symbol = symbol_example # String | Symbol name or ticker.
resolution = resolution_example # String | Symbol resolution. Possible resolutions are daily (`D` or `1D`, `2D` ... ),
weekly (`1W`, `2W` ...), monthly (`1M`, `2M`...) and an intra-day
resolution – minutes(`1`, `2` ...).

from = 1.2 # BigDecimal | Unix timestamp (UTC) of the leftmost required bar, including `from`.
to = 1.2 # BigDecimal | Unix timestamp (UTC) of the rightmost required bar, including `to`. It can be in the future.
In this case, the rightmost required bar is the latest available bar.

countback = 1.2 # BigDecimal | Number of bars (higher priority than `from`) starting with `to`. If
`countback` is set, `from` should be ignored.
 (optional)

try: 
    # History
    api_instance.history_get(symbol, resolution, from, to, countback=countback)
except ApiException as e:
    print("Exception when calling DataIntegrationApi->historyGet: %s\n" % e)

Parameters

Query parameters
Name Description
symbol*
String
Symbol name or ticker.
Required
resolution*
String
Symbol resolution. Possible resolutions are daily (`D` or `1D`, `2D` ... ), weekly (`1W`, `2W` ...), monthly (`1M`, `2M`...) and an intra-day resolution &ndash; minutes(`1`, `2` ...).
Required
from*
BigDecimal
Unix timestamp (UTC) of the leftmost required bar, including `from`.
Required
to*
BigDecimal
Unix timestamp (UTC) of the rightmost required bar, including `to`. It can be in the future. In this case, the rightmost required bar is the latest available bar.
Required
countback
BigDecimal
Number of bars (higher priority than `from`) starting with `to`. If `countback` is set, `from` should be ignored.

Responses

Status: 200 - response


streamingGet

Stream of prices

Stream of prices. Server constantly keeps the connection alive. If the connection is broken - the server constantly tries to restore it. BSC establishes up to 4 simultaneous connections to this endpoint and expects to get the same data to all of them. Transfer mode is `chunked encoding`. The data feed should set `'Transfer-Encoding: chunked'` and make sure that all intermediate proxies are set to use this mode. All messages are to be ended with `\n`. Data stream should contain real-time data only. It shouldn't contain snapshots of data. Data feed should provide ticks (trades, asks, bids) and daily bars. If trades are not provided, then data feed should set trades to bids. If there is only ask/bid implementation you must also set the trade (same as bid but it's size must be >= `1`). Size for trades is always >= `1` except for a correction. In case of correction - size can be `0`. Daily bars are required if they cannot be built from ticks (`has_daily` should be set to `true` in the symbol information). The broker must remove unnecessary restrictions (firewall, rate limits, etc.) for the set of IP addresses of our servers.


/streaming

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/streaming"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataIntegrationApi;

import java.io.File;
import java.util.*;

public class DataIntegrationApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();


        // Configure OAuth2 access token for authorization: ServerOAuth2Bearer
        OAuth ServerOAuth2Bearer = (OAuth) defaultClient.getAuthentication("ServerOAuth2Bearer");
        ServerOAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");

        DataIntegrationApi apiInstance = new DataIntegrationApi();
        try {
            apiInstance.streamingGet();
        } catch (ApiException e) {
            System.err.println("Exception when calling DataIntegrationApi#streamingGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.DataIntegrationApi;

public class DataIntegrationApiExample {

    public static void main(String[] args) {
        DataIntegrationApi apiInstance = new DataIntegrationApi();
        try {
            apiInstance.streamingGet();
        } catch (ApiException e) {
            System.err.println("Exception when calling DataIntegrationApi#streamingGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: ServerOAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

DataIntegrationApi *apiInstance = [[DataIntegrationApi alloc] init];

// Stream of prices
[apiInstance streamingGetWithCompletionHandler: 
              ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;


// Configure OAuth2 access token for authorization: ServerOAuth2Bearer
var ServerOAuth2Bearer = defaultClient.authentications['ServerOAuth2Bearer'];
ServerOAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"

var api = new BscRestApiSpecificationForBrokers.DataIntegrationApi()
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.streamingGet(callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class streamingGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: ServerOAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new DataIntegrationApi();

            try
            {
                // Stream of prices
                apiInstance.streamingGet();
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling DataIntegrationApi.streamingGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: ServerOAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiDataIntegrationApi();

try {
    $api_instance->streamingGet();
} catch (Exception $e) {
    echo 'Exception when calling DataIntegrationApi->streamingGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::DataIntegrationApi;

# Configure OAuth2 access token for authorization: ServerOAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::DataIntegrationApi->new();

eval { 
    $api_instance->streamingGet();
};
if ($@) {
    warn "Exception when calling DataIntegrationApi->streamingGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: ServerOAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.DataIntegrationApi()

try: 
    # Stream of prices
    api_instance.streaming_get()
except ApiException as e:
    print("Exception when calling DataIntegrationApi->streamingGet: %s\n" % e)

Parameters

Responses

Status: 200 - response


symbolInfoGet

Symbol Info

Get a list of all instruments.


/symbol_info

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/symbol_info?group="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataIntegrationApi;

import java.io.File;
import java.util.*;

public class DataIntegrationApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();


        // Configure OAuth2 access token for authorization: ServerOAuth2Bearer
        OAuth ServerOAuth2Bearer = (OAuth) defaultClient.getAuthentication("ServerOAuth2Bearer");
        ServerOAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");

        DataIntegrationApi apiInstance = new DataIntegrationApi();
        String group = group_example; // String | ID of a symbol group. If it presents then only symbols that belong to this group should be returned.
Possible values are provided by the [/groups](#operation/getGroups) endpoint.
It is only required if you use groups of symbols to restrict access to instrument's data.

        try {
            apiInstance.symbolInfoGet(group);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataIntegrationApi#symbolInfoGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.DataIntegrationApi;

public class DataIntegrationApiExample {

    public static void main(String[] args) {
        DataIntegrationApi apiInstance = new DataIntegrationApi();
        String group = group_example; // String | ID of a symbol group. If it presents then only symbols that belong to this group should be returned.
Possible values are provided by the [/groups](#operation/getGroups) endpoint.
It is only required if you use groups of symbols to restrict access to instrument's data.

        try {
            apiInstance.symbolInfoGet(group);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataIntegrationApi#symbolInfoGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: ServerOAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *group = group_example; // ID of a symbol group. If it presents then only symbols that belong to this group should be returned.
Possible values are provided by the [/groups](#operation/getGroups) endpoint.
It is only required if you use groups of symbols to restrict access to instrument's data.
 (optional)

DataIntegrationApi *apiInstance = [[DataIntegrationApi alloc] init];

// Symbol Info
[apiInstance symbolInfoGetWith:group
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;


// Configure OAuth2 access token for authorization: ServerOAuth2Bearer
var ServerOAuth2Bearer = defaultClient.authentications['ServerOAuth2Bearer'];
ServerOAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"

var api = new BscRestApiSpecificationForBrokers.DataIntegrationApi()
var opts = { 
  'group': group_example // {{String}} ID of a symbol group. If it presents then only symbols that belong to this group should be returned.
Possible values are provided by the [/groups](#operation/getGroups) endpoint.
It is only required if you use groups of symbols to restrict access to instrument's data.

};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.symbolInfoGet(opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class symbolInfoGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: ServerOAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new DataIntegrationApi();
            var group = group_example;  // String | ID of a symbol group. If it presents then only symbols that belong to this group should be returned.
Possible values are provided by the [/groups](#operation/getGroups) endpoint.
It is only required if you use groups of symbols to restrict access to instrument's data.
 (optional) 

            try
            {
                // Symbol Info
                apiInstance.symbolInfoGet(group);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling DataIntegrationApi.symbolInfoGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: ServerOAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiDataIntegrationApi();
$group = group_example; // String | ID of a symbol group. If it presents then only symbols that belong to this group should be returned.
Possible values are provided by the [/groups](#operation/getGroups) endpoint.
It is only required if you use groups of symbols to restrict access to instrument's data.


try {
    $api_instance->symbolInfoGet($group);
} catch (Exception $e) {
    echo 'Exception when calling DataIntegrationApi->symbolInfoGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::DataIntegrationApi;

# Configure OAuth2 access token for authorization: ServerOAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::DataIntegrationApi->new();
my $group = group_example; # String | ID of a symbol group. If it presents then only symbols that belong to this group should be returned.
Possible values are provided by the [/groups](#operation/getGroups) endpoint.
It is only required if you use groups of symbols to restrict access to instrument's data.


eval { 
    $api_instance->symbolInfoGet(group => $group);
};
if ($@) {
    warn "Exception when calling DataIntegrationApi->symbolInfoGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: ServerOAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.DataIntegrationApi()
group = group_example # String | ID of a symbol group. If it presents then only symbols that belong to this group should be returned.
Possible values are provided by the [/groups](#operation/getGroups) endpoint.
It is only required if you use groups of symbols to restrict access to instrument's data.
 (optional)

try: 
    # Symbol Info
    api_instance.symbol_info_get(group=group)
except ApiException as e:
    print("Exception when calling DataIntegrationApi->symbolInfoGet: %s\n" % e)

Parameters

Query parameters
Name Description
group
String
ID of a symbol group. If it presents then only symbols that belong to this group should be returned. Possible values are provided by the [/groups](#operation/getGroups) endpoint. It is only required if you use groups of symbols to restrict access to instrument's data.

Responses

Status: 200 - response

{
  "s": "ok",
  "symbol": [
    "VIXG2019",
    "AAPLE",
    "EURUSD"
  ],
  "description": [
    "Volatility Index",
    "Apple Inc",
    "EUR/USD"
  ],
  "currency": "USD",
  "base-currency": [
    null,
    null,
    "EUR"
  ],
  "exchange-listed": [
    "CBOE",
    "NASDAQ",
    "FOREX"
  ],
  "exchange-traded": [
    "CBOE",
    "NASDAQ",
    "FOREX"
  ],
  "minmovement": [
    1,
    1,
    1
  ],
  "minmov2": [
    0,
    0,
    0
  ],
  "fractional": [
    false,
    false,
    false
  ],
  "pricescale": [
    100,
    100,
    100000
  ],
  "root": [
    "VIX",
    null,
    null
  ],
  "root-description": [
    "Volatility Index",
    null,
    null
  ],
  "has-intraday": [
    true,
    true,
    true
  ],
  "has-no-volume": [
    false,
    false,
    true
  ],
  "type": [
    "futures",
    "stock",
    "forex"
  ],
  "ticker": [
    "VIXG2019",
    "AAPLE",
    "EURUSD"
  ],
  "timezone": [
    "America/New_York",
    "America/New_York",
    "America/New_York"
  ],
  "session-regular": [
    "0000-2359:23456",
    "0930-1600",
    "1700-1700"
  ],
  "session-extended": [
    "0000-2359:23456",
    "0400-2000",
    "1700-1700"
  ],
  "session-premarket": [
    null,
    "0400-0930",
    null
  ],
  "session-postmarket": [
    null,
    "1600-2000",
    null
  ],
  "supported-resolutions": [
    [
      "1",
      "3",
      "5",
      "15",
      "30",
      "60",
      "240",
      "D",
      "W"
    ],
    [
      "1",
      "3",
      "5",
      "15",
      "30",
      "60",
      "240",
      "D",
      "W"
    ],
    [
      "1",
      "3",
      "5",
      "15",
      "30",
      "60",
      "240",
      "D",
      "W"
    ]
  ],
  "has-daily": [
    true,
    true,
    true
  ],
  "intraday-multipliers": [
    [
      "1",
      "3",
      "5",
      "15",
      "30",
      "60",
      "240"
    ],
    [
      "1",
      "3",
      "5",
      "15",
      "30",
      "60",
      "240"
    ],
    [
      "1",
      "3",
      "5",
      "15",
      "30",
      "60",
      "240"
    ]
  ],
  "has-weekly-and-monthly": [
    false,
    false,
    false
  ],
  "pointvalue": [
    10,
    1,
    0.00001
  ],
  "expiration": [
    20190213,
    null,
    null
  ],
  "bar-source": [
    "trade",
    "bid",
    "ask"
  ],
  "bar-transform": [
    "openprev",
    "openprev",
    "none"
  ],
  "bar-fillgaps": [
    "true",
    "true",
    "false"
  ]
}

MarketData

depthGet

Depth

Get current depth of market for the instrument. Optional.


/depth

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/depth?symbol="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.MarketDataApi;

import java.io.File;
import java.util.*;

public class MarketDataApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        MarketDataApi apiInstance = new MarketDataApi();
        String symbol = symbol_example; // String | Instrument name.
        try {
            apiInstance.depthGet(symbol);
        } catch (ApiException e) {
            System.err.println("Exception when calling MarketDataApi#depthGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.MarketDataApi;

public class MarketDataApiExample {

    public static void main(String[] args) {
        MarketDataApi apiInstance = new MarketDataApi();
        String symbol = symbol_example; // String | Instrument name.
        try {
            apiInstance.depthGet(symbol);
        } catch (ApiException e) {
            System.err.println("Exception when calling MarketDataApi#depthGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *symbol = symbol_example; // Instrument name.

MarketDataApi *apiInstance = [[MarketDataApi alloc] init];

// Depth
[apiInstance depthGetWith:symbol
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.MarketDataApi()
var symbol = symbol_example; // {{String}} Instrument name.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.depthGet(symbol, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class depthGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new MarketDataApi();
            var symbol = symbol_example;  // String | Instrument name.

            try
            {
                // Depth
                apiInstance.depthGet(symbol);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling MarketDataApi.depthGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiMarketDataApi();
$symbol = symbol_example; // String | Instrument name.

try {
    $api_instance->depthGet($symbol);
} catch (Exception $e) {
    echo 'Exception when calling MarketDataApi->depthGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::MarketDataApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::MarketDataApi->new();
my $symbol = symbol_example; # String | Instrument name.

eval { 
    $api_instance->depthGet(symbol => $symbol);
};
if ($@) {
    warn "Exception when calling MarketDataApi->depthGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.MarketDataApi()
symbol = symbol_example # String | Instrument name.

try: 
    # Depth
    api_instance.depth_get(symbol)
except ApiException as e:
    print("Exception when calling MarketDataApi->depthGet: %s\n" % e)

Parameters

Query parameters
Name Description
symbol*
String
Instrument name.
Required

Responses

Status: 200 - response


quotesGet

Quotes

Get current prices of the instrument.


/quotes

Usage and SDK Samples

curl -X GET "https://api.bsc.com.vn:1337/quotes?symbols="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.MarketDataApi;

import java.io.File;
import java.util.*;

public class MarketDataApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        MarketDataApi apiInstance = new MarketDataApi();
        String symbols = symbols_example; // String | Comma separated symbol list.
        try {
            apiInstance.quotesGet(symbols);
        } catch (ApiException e) {
            System.err.println("Exception when calling MarketDataApi#quotesGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.MarketDataApi;

public class MarketDataApiExample {

    public static void main(String[] args) {
        MarketDataApi apiInstance = new MarketDataApi();
        String symbols = symbols_example; // String | Comma separated symbol list.
        try {
            apiInstance.quotesGet(symbols);
        } catch (ApiException e) {
            System.err.println("Exception when calling MarketDataApi#quotesGet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *symbols = symbols_example; // Comma separated symbol list.

MarketDataApi *apiInstance = [[MarketDataApi alloc] init];

// Quotes
[apiInstance quotesGetWith:symbols
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.MarketDataApi()
var symbols = symbols_example; // {{String}} Comma separated symbol list.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.quotesGet(symbols, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class quotesGetExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new MarketDataApi();
            var symbols = symbols_example;  // String | Comma separated symbol list.

            try
            {
                // Quotes
                apiInstance.quotesGet(symbols);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling MarketDataApi.quotesGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiMarketDataApi();
$symbols = symbols_example; // String | Comma separated symbol list.

try {
    $api_instance->quotesGet($symbols);
} catch (Exception $e) {
    echo 'Exception when calling MarketDataApi->quotesGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::MarketDataApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::MarketDataApi->new();
my $symbols = symbols_example; # String | Comma separated symbol list.

eval { 
    $api_instance->quotesGet(symbols => $symbols);
};
if ($@) {
    warn "Exception when calling MarketDataApi->quotesGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.MarketDataApi()
symbols = symbols_example # String | Comma separated symbol list.

try: 
    # Quotes
    api_instance.quotes_get(symbols)
except ApiException as e:
    print("Exception when calling MarketDataApi->quotesGet: %s\n" % e)

Parameters

Query parameters
Name Description
symbols*
String
Comma separated symbol list.
Required

Responses

Status: 200 - response


PasswordAuthentication

authorize

Authorize

Username and password authentication with the optional 2FA support.


/authorize

Usage and SDK Samples

curl -X POST "https://api.bsc.com.vn:1337/authorize"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.PasswordAuthenticationApi;

import java.io.File;
import java.util.*;

public class PasswordAuthenticationApiExample {

    public static void main(String[] args) {
        
        PasswordAuthenticationApi apiInstance = new PasswordAuthenticationApi();
        String login = login_example; // String | 
        String password = password_example; // String | 
        String 2faCode = 2faCode_example; // String | 
        try {
            apiInstance.authorize(login, password, 2faCode);
        } catch (ApiException e) {
            System.err.println("Exception when calling PasswordAuthenticationApi#authorize");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.PasswordAuthenticationApi;

public class PasswordAuthenticationApiExample {

    public static void main(String[] args) {
        PasswordAuthenticationApi apiInstance = new PasswordAuthenticationApi();
        String login = login_example; // String | 
        String password = password_example; // String | 
        String 2faCode = 2faCode_example; // String | 
        try {
            apiInstance.authorize(login, password, 2faCode);
        } catch (ApiException e) {
            System.err.println("Exception when calling PasswordAuthenticationApi#authorize");
            e.printStackTrace();
        }
    }
}
String *login = login_example; // 
String *password = password_example; // 
String *2faCode = 2faCode_example; // 

PasswordAuthenticationApi *apiInstance = [[PasswordAuthenticationApi alloc] init];

// Authorize
[apiInstance authorizeWith:login
    password:password
    2faCode:2faCode
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');

var api = new BscRestApiSpecificationForBrokers.PasswordAuthenticationApi()
var login = login_example; // {{String}} 
var password = password_example; // {{String}} 
var 2faCode = 2faCode_example; // {{String}} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.authorize(loginpassword2faCode, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class authorizeExample
    {
        public void main()
        {

            var apiInstance = new PasswordAuthenticationApi();
            var login = login_example;  // String | 
            var password = password_example;  // String | 
            var 2faCode = 2faCode_example;  // String | 

            try
            {
                // Authorize
                apiInstance.authorize(login, password, 2faCode);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PasswordAuthenticationApi.authorize: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\ApiPasswordAuthenticationApi();
$login = login_example; // String | 
$password = password_example; // String | 
$2faCode = 2faCode_example; // String | 

try {
    $api_instance->authorize($login, $password, $2faCode);
} catch (Exception $e) {
    echo 'Exception when calling PasswordAuthenticationApi->authorize: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::PasswordAuthenticationApi;

my $api_instance = WWW::SwaggerClient::PasswordAuthenticationApi->new();
my $login = login_example; # String | 
my $password = password_example; # String | 
my $2faCode = 2faCode_example; # String | 

eval { 
    $api_instance->authorize(login => $login, password => $password, 2faCode => $2faCode);
};
if ($@) {
    warn "Exception when calling PasswordAuthenticationApi->authorize: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.PasswordAuthenticationApi()
login = login_example # String | 
password = password_example # String | 
2faCode = 2faCode_example # String | 

try: 
    # Authorize
    api_instance.authorize(login, password, 2faCode)
except ApiException as e:
    print("Exception when calling PasswordAuthenticationApi->authorize: %s\n" % e)

Parameters

Form parameters
Name Description
login*
String
Required
password*
String
Required
2faCode*
String
Required

Responses

Status: 200 - response


Trading

accountsAccountIdOrdersOrderIdDelete

Cancel Order

Cancel an existing order.


/accounts/{accountId}/orders/{orderId}

Usage and SDK Samples

curl -X DELETE "https://api.bsc.com.vn:1337/accounts/{accountId}/orders/{orderId}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.TradingApi;

import java.io.File;
import java.util.*;

public class TradingApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        TradingApi apiInstance = new TradingApi();
        String accountId = accountId_example; // String | Account identifier.
        String orderId = orderId_example; // String | Order identifier.
        try {
            apiInstance.accountsAccountIdOrdersOrderIdDelete(accountId, orderId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdOrdersOrderIdDelete");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.TradingApi;

public class TradingApiExample {

    public static void main(String[] args) {
        TradingApi apiInstance = new TradingApi();
        String accountId = accountId_example; // String | Account identifier.
        String orderId = orderId_example; // String | Order identifier.
        try {
            apiInstance.accountsAccountIdOrdersOrderIdDelete(accountId, orderId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdOrdersOrderIdDelete");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.
String *orderId = orderId_example; // Order identifier.

TradingApi *apiInstance = [[TradingApi alloc] init];

// Cancel Order
[apiInstance accountsAccountIdOrdersOrderIdDeleteWith:accountId
    orderId:orderId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.TradingApi()
var accountId = accountId_example; // {{String}} Account identifier.
var orderId = orderId_example; // {{String}} Order identifier.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdOrdersOrderIdDelete(accountId, orderId, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdOrdersOrderIdDeleteExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new TradingApi();
            var accountId = accountId_example;  // String | Account identifier.
            var orderId = orderId_example;  // String | Order identifier.

            try
            {
                // Cancel Order
                apiInstance.accountsAccountIdOrdersOrderIdDelete(accountId, orderId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling TradingApi.accountsAccountIdOrdersOrderIdDelete: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiTradingApi();
$accountId = accountId_example; // String | Account identifier.
$orderId = orderId_example; // String | Order identifier.

try {
    $api_instance->accountsAccountIdOrdersOrderIdDelete($accountId, $orderId);
} catch (Exception $e) {
    echo 'Exception when calling TradingApi->accountsAccountIdOrdersOrderIdDelete: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::TradingApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::TradingApi->new();
my $accountId = accountId_example; # String | Account identifier.
my $orderId = orderId_example; # String | Order identifier.

eval { 
    $api_instance->accountsAccountIdOrdersOrderIdDelete(accountId => $accountId, orderId => $orderId);
};
if ($@) {
    warn "Exception when calling TradingApi->accountsAccountIdOrdersOrderIdDelete: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.TradingApi()
accountId = accountId_example # String | Account identifier.
orderId = orderId_example # String | Order identifier.

try: 
    # Cancel Order
    api_instance.accounts_account_id_orders_order_id_delete(accountId, orderId)
except ApiException as e:
    print("Exception when calling TradingApi->accountsAccountIdOrdersOrderIdDelete: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required
orderId*
String
Order identifier.
Required

Responses

Status: 200 - response

{
  "s": "ok"
}

accountsAccountIdOrdersOrderIdPut

Modify Order

Modify an existing order.


/accounts/{accountId}/orders/{orderId}

Usage and SDK Samples

curl -X PUT "https://api.bsc.com.vn:1337/accounts/{accountId}/orders/{orderId}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.TradingApi;

import java.io.File;
import java.util.*;

public class TradingApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        TradingApi apiInstance = new TradingApi();
        String accountId = accountId_example; // String | Account identifier.
        String orderId = orderId_example; // String | Order identifier.
        BigDecimal qty = 1.2; // BigDecimal | 
        BigDecimal limitPrice = 1.2; // BigDecimal | 
        BigDecimal stopPrice = 1.2; // BigDecimal | 
        String durationType = durationType_example; // String | 
        BigDecimal durationDateTime = 1.2; // BigDecimal | 
        BigDecimal stopLoss = 1.2; // BigDecimal | 
        BigDecimal takeProfit = 1.2; // BigDecimal | 
        String digitalSignature = digitalSignature_example; // String | 
        #/components/parameters/requestId requestId = ; // #/components/parameters/requestId | 
        try {
            apiInstance.accountsAccountIdOrdersOrderIdPut(accountId, orderId, qty, limitPrice, stopPrice, durationType, durationDateTime, stopLoss, takeProfit, digitalSignature, requestId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdOrdersOrderIdPut");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.TradingApi;

public class TradingApiExample {

    public static void main(String[] args) {
        TradingApi apiInstance = new TradingApi();
        String accountId = accountId_example; // String | Account identifier.
        String orderId = orderId_example; // String | Order identifier.
        BigDecimal qty = 1.2; // BigDecimal | 
        BigDecimal limitPrice = 1.2; // BigDecimal | 
        BigDecimal stopPrice = 1.2; // BigDecimal | 
        String durationType = durationType_example; // String | 
        BigDecimal durationDateTime = 1.2; // BigDecimal | 
        BigDecimal stopLoss = 1.2; // BigDecimal | 
        BigDecimal takeProfit = 1.2; // BigDecimal | 
        String digitalSignature = digitalSignature_example; // String | 
        #/components/parameters/requestId requestId = ; // #/components/parameters/requestId | 
        try {
            apiInstance.accountsAccountIdOrdersOrderIdPut(accountId, orderId, qty, limitPrice, stopPrice, durationType, durationDateTime, stopLoss, takeProfit, digitalSignature, requestId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdOrdersOrderIdPut");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.
String *orderId = orderId_example; // Order identifier.
BigDecimal *qty = 1.2; //  (optional)
BigDecimal *limitPrice = 1.2; //  (optional)
BigDecimal *stopPrice = 1.2; //  (optional)
String *durationType = durationType_example; //  (optional)
BigDecimal *durationDateTime = 1.2; //  (optional)
BigDecimal *stopLoss = 1.2; //  (optional)
BigDecimal *takeProfit = 1.2; //  (optional)
String *digitalSignature = digitalSignature_example; //  (optional)
#/components/parameters/requestId *requestId = ; //  (optional)

TradingApi *apiInstance = [[TradingApi alloc] init];

// Modify Order
[apiInstance accountsAccountIdOrdersOrderIdPutWith:accountId
    orderId:orderId
    qty:qty
    limitPrice:limitPrice
    stopPrice:stopPrice
    durationType:durationType
    durationDateTime:durationDateTime
    stopLoss:stopLoss
    takeProfit:takeProfit
    digitalSignature:digitalSignature
    requestId:requestId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.TradingApi()
var accountId = accountId_example; // {{String}} Account identifier.
var orderId = orderId_example; // {{String}} Order identifier.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdOrdersOrderIdPut(accountIdorderId, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdOrdersOrderIdPutExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new TradingApi();
            var accountId = accountId_example;  // String | Account identifier.
            var orderId = orderId_example;  // String | Order identifier.
            var qty = 1.2;  // BigDecimal |  (optional) 
            var limitPrice = 1.2;  // BigDecimal |  (optional) 
            var stopPrice = 1.2;  // BigDecimal |  (optional) 
            var durationType = durationType_example;  // String |  (optional) 
            var durationDateTime = 1.2;  // BigDecimal |  (optional) 
            var stopLoss = 1.2;  // BigDecimal |  (optional) 
            var takeProfit = 1.2;  // BigDecimal |  (optional) 
            var digitalSignature = digitalSignature_example;  // String |  (optional) 
            var requestId = new #/components/parameters/requestId(); // #/components/parameters/requestId |  (optional) 

            try
            {
                // Modify Order
                apiInstance.accountsAccountIdOrdersOrderIdPut(accountId, orderId, qty, limitPrice, stopPrice, durationType, durationDateTime, stopLoss, takeProfit, digitalSignature, requestId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling TradingApi.accountsAccountIdOrdersOrderIdPut: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiTradingApi();
$accountId = accountId_example; // String | Account identifier.
$orderId = orderId_example; // String | Order identifier.
$qty = 1.2; // BigDecimal | 
$limitPrice = 1.2; // BigDecimal | 
$stopPrice = 1.2; // BigDecimal | 
$durationType = durationType_example; // String | 
$durationDateTime = 1.2; // BigDecimal | 
$stopLoss = 1.2; // BigDecimal | 
$takeProfit = 1.2; // BigDecimal | 
$digitalSignature = digitalSignature_example; // String | 
$requestId = ; // #/components/parameters/requestId | 

try {
    $api_instance->accountsAccountIdOrdersOrderIdPut($accountId, $orderId, $qty, $limitPrice, $stopPrice, $durationType, $durationDateTime, $stopLoss, $takeProfit, $digitalSignature, $requestId);
} catch (Exception $e) {
    echo 'Exception when calling TradingApi->accountsAccountIdOrdersOrderIdPut: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::TradingApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::TradingApi->new();
my $accountId = accountId_example; # String | Account identifier.
my $orderId = orderId_example; # String | Order identifier.
my $qty = 1.2; # BigDecimal | 
my $limitPrice = 1.2; # BigDecimal | 
my $stopPrice = 1.2; # BigDecimal | 
my $durationType = durationType_example; # String | 
my $durationDateTime = 1.2; # BigDecimal | 
my $stopLoss = 1.2; # BigDecimal | 
my $takeProfit = 1.2; # BigDecimal | 
my $digitalSignature = digitalSignature_example; # String | 
my $requestId = ; # #/components/parameters/requestId | 

eval { 
    $api_instance->accountsAccountIdOrdersOrderIdPut(accountId => $accountId, orderId => $orderId, qty => $qty, limitPrice => $limitPrice, stopPrice => $stopPrice, durationType => $durationType, durationDateTime => $durationDateTime, stopLoss => $stopLoss, takeProfit => $takeProfit, digitalSignature => $digitalSignature, requestId => $requestId);
};
if ($@) {
    warn "Exception when calling TradingApi->accountsAccountIdOrdersOrderIdPut: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.TradingApi()
accountId = accountId_example # String | Account identifier.
orderId = orderId_example # String | Order identifier.
qty = 1.2 # BigDecimal |  (optional)
limitPrice = 1.2 # BigDecimal |  (optional)
stopPrice = 1.2 # BigDecimal |  (optional)
durationType = durationType_example # String |  (optional)
durationDateTime = 1.2 # BigDecimal |  (optional)
stopLoss = 1.2 # BigDecimal |  (optional)
takeProfit = 1.2 # BigDecimal |  (optional)
digitalSignature = digitalSignature_example # String |  (optional)
requestId =  # #/components/parameters/requestId |  (optional)

try: 
    # Modify Order
    api_instance.accounts_account_id_orders_order_id_put(accountId, orderId, qty=qty, limitPrice=limitPrice, stopPrice=stopPrice, durationType=durationType, durationDateTime=durationDateTime, stopLoss=stopLoss, takeProfit=takeProfit, digitalSignature=digitalSignature, requestId=requestId)
except ApiException as e:
    print("Exception when calling TradingApi->accountsAccountIdOrdersOrderIdPut: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required
orderId*
String
Order identifier.
Required
Form parameters
Name Description
qty
BigDecimal
limitPrice
BigDecimal
stopPrice
BigDecimal
durationType
String
durationDateTime
BigDecimal
stopLoss
BigDecimal
takeProfit
BigDecimal
digitalSignature
String
requestId
#/components/parameters/requestId

Responses

Status: 200 - response

{
  "qty": 2,
  "limitPrice": 0,
  "stopPrice": 0,
  "durationType": "string",
  "durationDateTime": 0,
  "stopLoss": 0,
  "takeProfit": 0,
  "digitalSignature": "string",
  "requestId": 23425678343
}

accountsAccountIdOrdersPost

Place Order

Place a new order.


/accounts/{accountId}/orders

Usage and SDK Samples

curl -X POST "https://api.bsc.com.vn:1337/accounts/{accountId}/orders?requestId="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.TradingApi;

import java.io.File;
import java.util.*;

public class TradingApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        TradingApi apiInstance = new TradingApi();
        Body_1 body = ; // Body_1 | 
        String accountId = accountId_example; // String | Account identifier.
        String requestId = requestId_example; // String | Unique identifier for a request.
        try {
            apiInstance.accountsAccountIdOrdersPost(body, accountId, requestId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdOrdersPost");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.TradingApi;

public class TradingApiExample {

    public static void main(String[] args) {
        TradingApi apiInstance = new TradingApi();
        Body_1 body = ; // Body_1 | 
        String accountId = accountId_example; // String | Account identifier.
        String requestId = requestId_example; // String | Unique identifier for a request.
        try {
            apiInstance.accountsAccountIdOrdersPost(body, accountId, requestId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdOrdersPost");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
Body_1 *body = ; // 
String *accountId = accountId_example; // Account identifier.
String *requestId = requestId_example; // Unique identifier for a request. (optional)

TradingApi *apiInstance = [[TradingApi alloc] init];

// Place Order
[apiInstance accountsAccountIdOrdersPostWith:body
    accountId:accountId
    requestId:requestId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.TradingApi()
var body = ; // {{Body_1}} 
var accountId = accountId_example; // {{String}} Account identifier.
var opts = { 
  'requestId': requestId_example // {{String}} Unique identifier for a request.
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdOrdersPost(bodyaccountId, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdOrdersPostExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new TradingApi();
            var body = new Body_1(); // Body_1 | 
            var accountId = accountId_example;  // String | Account identifier.
            var requestId = requestId_example;  // String | Unique identifier for a request. (optional) 

            try
            {
                // Place Order
                apiInstance.accountsAccountIdOrdersPost(body, accountId, requestId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling TradingApi.accountsAccountIdOrdersPost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiTradingApi();
$body = ; // Body_1 | 
$accountId = accountId_example; // String | Account identifier.
$requestId = requestId_example; // String | Unique identifier for a request.

try {
    $api_instance->accountsAccountIdOrdersPost($body, $accountId, $requestId);
} catch (Exception $e) {
    echo 'Exception when calling TradingApi->accountsAccountIdOrdersPost: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::TradingApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::TradingApi->new();
my $body = WWW::SwaggerClient::Object::Body_1->new(); # Body_1 | 
my $accountId = accountId_example; # String | Account identifier.
my $requestId = requestId_example; # String | Unique identifier for a request.

eval { 
    $api_instance->accountsAccountIdOrdersPost(body => $body, accountId => $accountId, requestId => $requestId);
};
if ($@) {
    warn "Exception when calling TradingApi->accountsAccountIdOrdersPost: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.TradingApi()
body =  # Body_1 | 
accountId = accountId_example # String | Account identifier.
requestId = requestId_example # String | Unique identifier for a request. (optional)

try: 
    # Place Order
    api_instance.accounts_account_id_orders_post(body, accountId, requestId=requestId)
except ApiException as e:
    print("Exception when calling TradingApi->accountsAccountIdOrdersPost: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required
Body parameters
Name Description
body *
Query parameters
Name Description
requestId
String
Unique identifier for a request.

Responses

Status: 200 - response

{
  "instrument": "EURUSD",
  "qty": 1,
  "side": "buy",
  "type": "limit",
  "limitPrice": 1.23456,
  "stopPrice": 0,
  "durationType": "gtt",
  "durationDateTime": 1548406235,
  "stopLoss": 0,
  "takeProfit": 0,
  "digitalSignature": "954345868"
}

accountsAccountIdPositionsPositionIdDelete

Close Position

Close an existing position.


/accounts/{accountId}/positions/{positionId}

Usage and SDK Samples

curl -X DELETE "https://api.bsc.com.vn:1337/accounts/{accountId}/positions/{positionId}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.TradingApi;

import java.io.File;
import java.util.*;

public class TradingApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        TradingApi apiInstance = new TradingApi();
        String accountId = accountId_example; // String | Account identifier.
        String positionId = positionId_example; // String | Position identifier.
        try {
            apiInstance.accountsAccountIdPositionsPositionIdDelete(accountId, positionId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdPositionsPositionIdDelete");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.TradingApi;

public class TradingApiExample {

    public static void main(String[] args) {
        TradingApi apiInstance = new TradingApi();
        String accountId = accountId_example; // String | Account identifier.
        String positionId = positionId_example; // String | Position identifier.
        try {
            apiInstance.accountsAccountIdPositionsPositionIdDelete(accountId, positionId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdPositionsPositionIdDelete");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
String *accountId = accountId_example; // Account identifier.
String *positionId = positionId_example; // Position identifier.

TradingApi *apiInstance = [[TradingApi alloc] init];

// Close Position
[apiInstance accountsAccountIdPositionsPositionIdDeleteWith:accountId
    positionId:positionId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.TradingApi()
var accountId = accountId_example; // {{String}} Account identifier.
var positionId = positionId_example; // {{String}} Position identifier.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdPositionsPositionIdDelete(accountId, positionId, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdPositionsPositionIdDeleteExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new TradingApi();
            var accountId = accountId_example;  // String | Account identifier.
            var positionId = positionId_example;  // String | Position identifier.

            try
            {
                // Close Position
                apiInstance.accountsAccountIdPositionsPositionIdDelete(accountId, positionId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling TradingApi.accountsAccountIdPositionsPositionIdDelete: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiTradingApi();
$accountId = accountId_example; // String | Account identifier.
$positionId = positionId_example; // String | Position identifier.

try {
    $api_instance->accountsAccountIdPositionsPositionIdDelete($accountId, $positionId);
} catch (Exception $e) {
    echo 'Exception when calling TradingApi->accountsAccountIdPositionsPositionIdDelete: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::TradingApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::TradingApi->new();
my $accountId = accountId_example; # String | Account identifier.
my $positionId = positionId_example; # String | Position identifier.

eval { 
    $api_instance->accountsAccountIdPositionsPositionIdDelete(accountId => $accountId, positionId => $positionId);
};
if ($@) {
    warn "Exception when calling TradingApi->accountsAccountIdPositionsPositionIdDelete: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.TradingApi()
accountId = accountId_example # String | Account identifier.
positionId = positionId_example # String | Position identifier.

try: 
    # Close Position
    api_instance.accounts_account_id_positions_position_id_delete(accountId, positionId)
except ApiException as e:
    print("Exception when calling TradingApi->accountsAccountIdPositionsPositionIdDelete: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required
positionId*
String
Position identifier.
Required

Responses

Status: 200 - response

{
  "s": "ok"
}

accountsAccountIdPositionsPositionIdPut

Modify Position

Modify an existing position stop loss or take profit or both.


/accounts/{accountId}/positions/{positionId}

Usage and SDK Samples

curl -X PUT "https://api.bsc.com.vn:1337/accounts/{accountId}/positions/{positionId}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.TradingApi;

import java.io.File;
import java.util.*;

public class TradingApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure OAuth2 access token for authorization: OAuth2Bearer
        OAuth OAuth2Bearer = (OAuth) defaultClient.getAuthentication("OAuth2Bearer");
        OAuth2Bearer.setAccessToken("YOUR ACCESS TOKEN");


        TradingApi apiInstance = new TradingApi();
        BigDecimal stopLoss = 1.2; // BigDecimal | 
        BigDecimal takeProfit = 1.2; // BigDecimal | 
        String accountId = accountId_example; // String | Account identifier.
        String positionId = positionId_example; // String | Position identifier.
        try {
            apiInstance.accountsAccountIdPositionsPositionIdPut(stopLoss, takeProfit, accountId, positionId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdPositionsPositionIdPut");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.TradingApi;

public class TradingApiExample {

    public static void main(String[] args) {
        TradingApi apiInstance = new TradingApi();
        BigDecimal stopLoss = 1.2; // BigDecimal | 
        BigDecimal takeProfit = 1.2; // BigDecimal | 
        String accountId = accountId_example; // String | Account identifier.
        String positionId = positionId_example; // String | Position identifier.
        try {
            apiInstance.accountsAccountIdPositionsPositionIdPut(stopLoss, takeProfit, accountId, positionId);
        } catch (ApiException e) {
            System.err.println("Exception when calling TradingApi#accountsAccountIdPositionsPositionIdPut");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Bearer)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
BigDecimal *stopLoss = 1.2; // 
BigDecimal *takeProfit = 1.2; // 
String *accountId = accountId_example; // Account identifier.
String *positionId = positionId_example; // Position identifier.

TradingApi *apiInstance = [[TradingApi alloc] init];

// Modify Position
[apiInstance accountsAccountIdPositionsPositionIdPutWith:stopLoss
    takeProfit:takeProfit
    accountId:accountId
    positionId:positionId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var BscRestApiSpecificationForBrokers = require('bsc_rest_api_specification_for_brokers');
var defaultClient = BscRestApiSpecificationForBrokers.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAuth2Bearer
var OAuth2Bearer = defaultClient.authentications['OAuth2Bearer'];
OAuth2Bearer.accessToken = "YOUR ACCESS TOKEN"


var api = new BscRestApiSpecificationForBrokers.TradingApi()
var stopLoss = 1.2; // {{BigDecimal}} 
var takeProfit = 1.2; // {{BigDecimal}} 
var accountId = accountId_example; // {{String}} Account identifier.
var positionId = positionId_example; // {{String}} Position identifier.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.accountsAccountIdPositionsPositionIdPut(stopLosstakeProfitaccountIdpositionId, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class accountsAccountIdPositionsPositionIdPutExample
    {
        public void main()
        {

            // Configure OAuth2 access token for authorization: OAuth2Bearer
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new TradingApi();
            var stopLoss = 1.2;  // BigDecimal | 
            var takeProfit = 1.2;  // BigDecimal | 
            var accountId = accountId_example;  // String | Account identifier.
            var positionId = positionId_example;  // String | Position identifier.

            try
            {
                // Modify Position
                apiInstance.accountsAccountIdPositionsPositionIdPut(stopLoss, takeProfit, accountId, positionId);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling TradingApi.accountsAccountIdPositionsPositionIdPut: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2Bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$api_instance = new Swagger\Client\ApiTradingApi();
$stopLoss = 1.2; // BigDecimal | 
$takeProfit = 1.2; // BigDecimal | 
$accountId = accountId_example; // String | Account identifier.
$positionId = positionId_example; // String | Position identifier.

try {
    $api_instance->accountsAccountIdPositionsPositionIdPut($stopLoss, $takeProfit, $accountId, $positionId);
} catch (Exception $e) {
    echo 'Exception when calling TradingApi->accountsAccountIdPositionsPositionIdPut: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::TradingApi;

# Configure OAuth2 access token for authorization: OAuth2Bearer
$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = WWW::SwaggerClient::TradingApi->new();
my $stopLoss = 1.2; # BigDecimal | 
my $takeProfit = 1.2; # BigDecimal | 
my $accountId = accountId_example; # String | Account identifier.
my $positionId = positionId_example; # String | Position identifier.

eval { 
    $api_instance->accountsAccountIdPositionsPositionIdPut(stopLoss => $stopLoss, takeProfit => $takeProfit, accountId => $accountId, positionId => $positionId);
};
if ($@) {
    warn "Exception when calling TradingApi->accountsAccountIdPositionsPositionIdPut: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2Bearer
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = swagger_client.TradingApi()
stopLoss = 1.2 # BigDecimal | 
takeProfit = 1.2 # BigDecimal | 
accountId = accountId_example # String | Account identifier.
positionId = positionId_example # String | Position identifier.

try: 
    # Modify Position
    api_instance.accounts_account_id_positions_position_id_put(stopLoss, takeProfit, accountId, positionId)
except ApiException as e:
    print("Exception when calling TradingApi->accountsAccountIdPositionsPositionIdPut: %s\n" % e)

Parameters

Path parameters
Name Description
accountId*
String
Account identifier.
Required
positionId*
String
Position identifier.
Required
Form parameters
Name Description
stopLoss*
BigDecimal
Required
takeProfit*
BigDecimal
Required

Responses

Status: 200 - response

{
  "s": "ok"
}