sscdev
======
.. py:module:: sscdev
Submodules
----------
.. toctree::
:maxdepth: 1
/autoapi/sscdev/databricks/index
/autoapi/sscdev/datalake/index
/autoapi/sscdev/keyvault/index
/autoapi/sscdev/luno/index
/autoapi/sscdev/monitor/index
/autoapi/sscdev/sql/index
/autoapi/sscdev/utils/index
/autoapi/sscdev/version/index
/autoapi/sscdev/weather/index
Attributes
----------
.. autoapisummary::
sscdev.__version__
Classes
-------
.. autoapisummary::
sscdev.KeyVaultClient
sscdev.SqlClient
sscdev.OpenMeteo
sscdev.DataLakeClient
sscdev.Utilities
sscdev.LunoClient
sscdev.DatabricksClient
Functions
---------
.. autoapisummary::
sscdev.collect_logs
Package Contents
----------------
.. py:class:: KeyVaultClient
Allows management and retrieval of secrets from Azure Key Vault.
.. py:attribute:: client
.. py:method:: get_secret(secret_name: str) -> str
.. py:method:: set_secret(secret_name: str, secret_value: str) -> None
.. py:method:: delete_secret(secret_name: str) -> None
.. py:method:: list_secrets() -> list
.. py:class:: SqlClient(DB)
.. py:method:: connect_to_db(conn_string: str, max_retries: int = 10) -> None
Attempts to connect to the database using the provided connection string.
Parameters:
- conn_string (str): The database connection string.
- max_retries (int): The maximum number of connection attempts.
Raises:
- Exception: If unable to connect to the database after the specified attempts.
.. py:method:: read(query: str) -> pandas.DataFrame
Executes a read (SELECT) SQL query and returns the results as a pandas DataFrame.
Parameters:
- query (str): The SQL query to execute.
Returns:
- pd.DataFrame: The result of the SQL query.
Example:
>>> SqlClient.read('SELECT * FROM SalesLT.SalesOrderDetail')
.. py:method:: write(data: pandas.DataFrame, table: str, schema: str = None, if_exists='append') -> None
Writes data to the specified SQL table.
Parameters:
- data (pd.DataFrame): The pandas DataFrame to write to the table.
- table (str): The name of the SQL table to write to.
- schema (str): The schema name in the database. Default is None.
- if_exists (str): Behavior when the table already exists.
Default is "append". Other options include "replace" and "fail".
Example:
>>> SqlClient.write(data, "Historical", "Weather")
.. py:method:: query(query: str) -> None
Executes a general SQL query (e.g., INSERT, UPDATE, DELETE).
Parameters:
- query (str): The SQL query to execute.
Example:
>>> SqlClient.query('INSERT INTO TableName (column1, column2) VALUES (value1, value2)')
.. py:method:: list_schemas() -> list
Lists all schemas in the connected database.
Returns:
- list: A list of schema names in the database.
Example:
>>> SqlClient.list_schemas()
.. py:method:: list_tables(schema: str = None) -> list
Lists all tables in the connected database, optionally under a specified schema.
Parameters:
- schema (str): The schema name (optional).
Returns:
- list: A list of table names in the specified schema or all tables if schema is not specified.
Example:
>>> SqlClient.list_tables()
>>> SqlClient.list_tables(schema='public')
.. py:method:: table_exists(table_name: str, schema: str = None) -> bool
Checks if a specific table exists in the database.
Parameters:
- table_name (str): The name of the table to check.
- schema (str, optional): The schema name in the database.
Returns:
- bool: True if the table exists, False otherwise.
Example:
>>> SqlClient.table_exists('SalesOrderDetail', schema='SalesLT')
.. py:method:: get_columns(table_name: str, schema: str = None) -> pandas.DataFrame
Retrieves the columns and their data types from a specific table.
Parameters:
- table_name (str): The name of the table.
- schema (str, optional): The schema name in the database.
Returns:
- pd.DataFrame: DataFrame containing column names and data types.
Example:
>>> SqlClient.get_columns('SalesOrderDetail', schema='SalesLT')
.. py:method:: close_connection() -> None
Closes the database connection.
Example:
>>> SqlClient.close_connection()
.. py:method:: execute_stored_procedure(procedure_name: str, params: dict = None) -> pandas.DataFrame
Executes a stored procedure and returns the result.
Parameters:
- procedure_name (str): The name of the stored procedure to execute.
- params (dict, optional): A dictionary of parameters to pass to the procedure.
Returns:
- pd.DataFrame: The result of the stored procedure.
Example:
>>> SqlClient.execute_stored_procedure('sp_GetSalesData', {'param1': 'value1'})
.. py:class:: OpenMeteo
.. py:method:: get_history(latitude: float, longitude: float, start_date: str, end_date: str) -> pandas.DataFrame
Fetches historical weather data for the given coordinates and date range.
Parameters:
- latitude (float): Latitude of the location.
- longitude (float): Longitude of the location.
- start_date (str): The start date for the historical data in YYYY-MM-DD format.
- end_date (str): The end date for the historical data in YYYY-MM-DD format.
Returns:
- pd.DataFrame: A DataFrame containing the historical weather data.
Example:
>>> OpenMeteo.get_weather_history(35.6895, 139.6917, '2023-01-01', '2023-01-07')
.. py:method:: get_forecast(latitude: float, longitude: float) -> pandas.DataFrame
Fetches weather forecast data for the given coordinates.
Parameters:
- latitude (float): Latitude of the location.
- longitude (float): Longitude of the location.
Returns:
- pd.DataFrame: A DataFrame containing the weather forecast data.
Example:
>>> OpenMeteo.get_weather_forecast(35.6895, 139.6917)
.. py:method:: get_weather(latitude: float, longitude: float) -> pandas.DataFrame
Fetches current weather data for the given coordinates.
Parameters:
- latitude (float): Latitude of the location.
- longitude (float): Longitude of the location.
Returns:
- pd.DataFrame: A DataFrame containing the current weather data.
Example:
>>> OpenMeteo.get_current_weather(35.6895, 139.6917)
.. py:method:: get_alerts(latitude: float, longitude: float) -> pandas.DataFrame
Fetches weather alerts for the given coordinates.
Parameters:
- latitude (float): Latitude of the location.
- longitude (float): Longitude of the location.
Returns:
- pd.DataFrame: A DataFrame containing the weather alerts.
Example:
>>> OpenMeteo.get_weather_alerts(35.6895, 139.6917)
.. py:class:: DataLakeClient
DataLake Client to connect to Azure DataLake in SSCDEV
.. py:attribute:: service_client
.. py:attribute:: file_system_name
:value: 'dst'
.. py:attribute:: file_system_client
.. py:attribute:: directory_client
.. py:method:: create_container() -> None
.. py:method:: delete_container() -> None
.. py:method:: create_directory(directory_name: str) -> None
.. py:method:: delete_directory(directory_name: str) -> None
.. py:method:: ls(directory_name: str) -> list
.. py:method:: upload(file_name: str, content: bytes) -> None
.. py:method:: delete(file_name: str) -> None
.. py:method:: read(file_name: str) -> bytes
.. py:method:: move(source_file_name: str, destination_file_name: str) -> None
.. py:class:: Utilities
A utility class to manage environment setup, including package installations,
ODBC driver installations, firewall rule updates, and Aiven service IP filter updates.
.. py:method:: firewall(service=None)
Updates the firewall rule for the specified service.
If no service is specified, updates both SQL Server and PostgreSQL Server firewall rules.
.. py:method:: ip()
:staticmethod:
Retrieves the current public IP address.
.. py:function:: collect_logs(func)
Decorator for logging function calls and tracing with Azure Monitor.
Args:
- func (function): The function to be wrapped by the decorator.
Returns:
- wrapper (function): The wrapped function with logging and tracing.
Example:
>>> @collect_logs
>>> def example_function(x, y):
>>> return x + y
.. py:class:: LunoClient(base_url='', timeout=0)
Bases: :py:obj:`LunoBaseClient`
Python SDK for the Luno API.
Example usage:
from luno_python.client import Client
c = Client(api_key_id='key_id', api_key_secret='key_secret')
try:
res = c.get_ticker(pair='XBTZAR')
print res
except Exception as e:
print e
.. py:method:: cancel_withdrawal(id)
Makes a call to DELETE /api/1/withdrawals/{id}.
Cancels a withdrawal request.
This can only be done if the request is still in state PENDING.
Permissions required: Perm_W_Withdrawals
:param id: ID of the withdrawal to cancel.
:type id: int
.. py:method:: create_account(currency, name)
Makes a call to POST /api/1/accounts.
This request creates an Account for the specified currency. Please note that the balances for the Account will be displayed based on the asset value, which is the currency the Account is based on.
Permissions required: Perm_W_Addresses
:param currency: The currency code for the Account you want to create. Please see the Currency section for a detailed list of currencies supported by the Luno platform.
Users must be verified to trade currency in order to be able to create an Account. For more information on the verification process, please see How do I verify my identity?.
Users have a limit of 10 accounts per currency.
:type currency: str
:param name: The label to use for this account
:type name: str
.. py:method:: create_beneficiary(account_type, bank_account_number, bank_name, bank_recipient)
Makes a call to POST /api/1/beneficiaries.
Create a new beneficiary.
Permissions required: Perm_W_Beneficiaries
:param account_type: Bank account type
:type account_type: str
:param bank_account_number: Beneficiary bank account number
:type bank_account_number: str
:param bank_name: Bank SWIFT code
:type bank_name: str
:param bank_recipient: The owner of the recipient account
:type bank_recipient: str
.. py:method:: create_funding_address(asset, account_id=None, name=None)
Makes a call to POST /api/1/funding_address.
Allocates a new receive address to your account. There is a rate limit of 1
address per hour, but bursts of up to 10 addresses are allowed. Only 1
Ethereum receive address can be created.
Permissions required: Perm_W_Addresses
:param asset: Currency code of the asset.
:type asset: str
:param account_id: An optional account_id to assign the new Receive Address too
:type account_id: int
:param name: An optional name for the new Receive Address
:type name: str
.. py:method:: create_withdrawal(amount, type, beneficiary_id=None, external_id=None, fast=None, reference=None)
Makes a call to POST /api/1/withdrawals.
Creates a new withdrawal request to the specified beneficiary.
Permissions required: Perm_W_Withdrawals
:param amount: Amount to withdraw. The currency withdrawn depends on the type setting.
:type amount: float
:param type: Withdrawal method.
:type type: str
:param beneficiary_id: The beneficiary ID of the bank account the withdrawal will be paid out to.
This parameter is required if the user has set up multiple beneficiaries.
The beneficiary ID can be found by selecting on the beneficiary name on the user’s Beneficiaries page.
:type beneficiary_id: int
:param external_id: Optional unique ID to associate with this withdrawal.
Useful to prevent duplicate sends.
This field supports all alphanumeric characters including "-" and "_".
:type external_id: str
:param fast: If true, it will be a fast withdrawal if possible. Fast withdrawals come with a fee.
Currently fast withdrawals are only available for `type=ZAR_EFT`; for other types, an error is returned.
Fast withdrawals are not possible for Bank of Baroda, Deutsche Bank, Merrill Lynch South Africa, UBS, Postbank and Tyme Bank.
The fee to be charged is the same as when withdrawing from the UI.
:type fast: bool
:param reference: For internal use.
Deprecated: We don't allow custom references and will remove this soon.
:type reference: str
.. py:method:: delete_beneficiary(id)
Makes a call to DELETE /api/1/beneficiaries/{id}.
Delete a beneficiary
Permissions required: Perm_W_Beneficiaries
:param id: ID of the Beneficiary to delete.
:type id: int
.. py:method:: get_balances(assets=None)
Makes a call to GET /api/1/balance.
The list of all Accounts and their respective balances for the requesting user.
Permissions required: Perm_R_Balance
:param assets: Only return balances for wallets with these currencies (if not provided,
all balances will be returned). To request balances for multiple currencies,
pass the parameter multiple times,
e.g. `assets=XBT&assets=ETH`.
:type assets: list
.. py:method:: get_candles(duration, pair, since)
Makes a call to GET /api/exchange/1/candles.
Get candlestick market data from the specified time until now, from the oldest to the most recent.
Permissions required: MP_None
:param duration: Candle duration in seconds.
For example, 300 corresponds to 5m candles. Currently supported
durations are: 60 (1m), 300 (5m), 900 (15m), 1800 (30m), 3600 (1h),
10800 (3h), 14400 (4h), 28800 (8h), 86400 (24h), 259200 (3d), 604800
(7d).
:type duration: int
:param pair: Currency pair
:type pair: str
:param since: Filter to candles starting on or after this timestamp (Unix milliseconds).
Only up to 1000 of the earliest candles are returned.
:type since: int
.. py:method:: get_fee_info(pair)
Makes a call to GET /api/1/fee_info.
Returns the fees and 30 day trading volume (as of midnight) for a given currency pair. For complete details, please see Fees & Features.
Permissions required: Perm_R_Orders
:param pair: Get fee information about this pair.
:type pair: str
.. py:method:: get_funding_address(asset, address=None)
Makes a call to GET /api/1/funding_address.
Returns the default receive address associated with your account and the
amount received via the address. Users can specify an optional address parameter to return information for a non-default receive address.
In the response, total_received is the total confirmed amount received excluding unconfirmed transactions.
total_unconfirmed is the total sum of unconfirmed receive transactions.
Permissions required: Perm_R_Addresses
:param asset: Currency code of the asset.
:type asset: str
:param address: Specific cryptocurrency address to retrieve. If not provided, the
default address will be used.
:type address: str
.. py:method:: get_move(client_move_id=None, id=None)
Makes a call to GET /api/exchange/1/move.
Get a specific move funds instruction by either id or
client_move_id. If both are provided an API error will be
returned.
Permissions required: MP_None
:param client_move_id: Get by the user defined ID. This is mutually exclusive with id and is required if id is
not provided.
:type client_move_id: str
:param id: Get by the system ID. This is mutually exclusive with client_move_id and is required if
client_move_id is not provided.
:type id: str
.. py:method:: get_order(id)
Makes a call to GET /api/1/orders/{id}.
Get an Order's details by its ID.
Permissions required: Perm_R_Orders
:param id: Order reference
:type id: str
.. py:method:: get_order_book(pair)
Makes a call to GET /api/1/orderbook_top.
This request returns the best 100 `bids` and `asks`, for the currency pair specified, in the Order Book.
`asks` are sorted by price ascending and `bids` are sorted by price descending.
Multiple orders at the same price are aggregated.
:param pair: Currency pair of the Orders to retrieve
:type pair: str
.. py:method:: get_order_book_full(pair)
Makes a call to GET /api/1/orderbook.
This request returns all `bids` and `asks`, for the currency pair specified, in the Order Book.
`asks` are sorted by price ascending and `bids` are sorted by price descending.
Multiple orders at the same price are not aggregated.
WARNING: This may return a large amount of data.
Users are recommended to use the top 100 bids and asks
or the Streaming API.
:param pair: Currency pair of the Orders to retrieve
:type pair: str
.. py:method:: get_order_v2(id)
Makes a call to GET /api/exchange/2/orders/{id}.
Get the details for an order.
Permissions required: Perm_R_Orders
:param id: Order reference
:type id: str
.. py:method:: get_order_v3(client_order_id=None, id=None)
Makes a call to GET /api/exchange/3/order.
Get the details for an order by order reference or client order ID.
Exactly one of the two parameters must be provided, otherwise an error is returned.
Permissions required: Perm_R_Orders
:param client_order_id: Client Order ID has the value that was passed in when the Order was posted.
:type client_order_id: str
:param id: Order reference
:type id: str
.. py:method:: get_ticker(pair)
Makes a call to GET /api/1/ticker.
Returns the latest ticker indicators for the specified currency pair.
Please see the Currency list for the complete list of supported currency pairs.
:param pair: Currency pair
:type pair: str
.. py:method:: get_tickers(pair=None)
Makes a call to GET /api/1/tickers.
Returns the latest ticker indicators from all active Luno exchanges.
Please see the Currency list for the complete list of supported currency pairs.
:param pair: Return tickers for multiple markets (if not provided, all tickers will be returned).
To request tickers for multiple markets, pass the parameter multiple times,
e.g. `pair=XBTZAR&pair=ETHZAR`.
:type pair: list
.. py:method:: get_withdrawal(id)
Makes a call to GET /api/1/withdrawals/{id}.
Returns the status of a particular withdrawal request.
Permissions required: Perm_R_Withdrawals
:param id: Withdrawal ID to retrieve.
:type id: int
.. py:method:: list_beneficiaries(bank_recipient=None)
Makes a call to GET /api/1/beneficiaries.
Returns a list of bank beneficiaries.
Permissions required: Perm_R_Beneficiaries
:param bank_recipient:
:type bank_recipient: str
.. py:method:: list_moves(before=None, limit=None)
Makes a call to GET /api/exchange/1/move/list_moves.
Returns a list of the most recent moves ordered from newest to oldest.
This endpoint will list up to 100 most recent moves by default.
Permissions required: MP_None
:param before: Filter to moves requested before this timestamp (Unix milliseconds)
:type before: int
:param limit: Limit to this many moves
:type limit: int
.. py:method:: list_orders(created_before=None, limit=None, pair=None, state=None)
Makes a call to GET /api/1/listorders.
Returns a list of the most recently placed Orders.
Users can specify an optional state=PENDING parameter to restrict the results to only open Orders.
Users can also specify the market by using the optional currency pair parameter.
Permissions required: Perm_R_Orders
:param created_before: Filter to orders created before this timestamp (Unix milliseconds)
:type created_before: int
:param limit: Limit to this many orders
:type limit: int
:param pair: Filter to only orders of this currency pair
:type pair: str
:param state: Filter to only orders of this state
:type state: str
.. py:method:: list_orders_v2(closed=None, created_before=None, limit=None, pair=None)
Makes a call to GET /api/exchange/2/listorders.
Returns a list of the most recently placed orders ordered from newest to
oldest. This endpoint will list up to 100 most recent open orders by
default.
Please note: This data is archived 100 days after an exchange order is completed.
Permissions required: Perm_R_Orders
:param closed: If true, will return closed orders instead of open orders.
:type closed: bool
:param created_before: Filter to orders created before this timestamp (Unix milliseconds)
:type created_before: int
:param limit: Limit to this many orders
:type limit: int
:param pair: Filter to only orders of this currency pair.
:type pair: str
.. py:method:: list_pending_transactions(id)
Makes a call to GET /api/1/accounts/{id}/pending.
Return a list of all transactions that have not completed for the Account.
Pending transactions are not numbered, and may be reordered, deleted or updated at any time.
Permissions required: Perm_R_Transactions
:param id: Account ID
:type id: int
.. py:method:: list_trades(pair, since=None)
Makes a call to GET /api/1/trades.
Returns a list of recent trades for the specified currency pair. At most
100 trades are returned per call and never trades older than 24h. The
trades are sorted from newest to oldest.
Please see the Currency list for the complete list of supported currency pairs.
:param pair: Currency pair of the market to list the trades from
:type pair: str
:param since: Fetch trades executed after this time, specified as a Unix timestamp in
milliseconds. An error will be returned if this is before 24h ago. Use
this parameter to either restrict to a shorter window or to iterate over
the trades in case you need more than the 100 most recent trades.
:type since: int
.. py:method:: list_transactions(id, max_row, min_row)
Makes a call to GET /api/1/accounts/{id}/transactions.
Return a list of transaction entries from an account.
Transaction entry rows are numbered sequentially starting from 1, where 1 is
the oldest entry. The range of rows to return are specified with the
min_row (inclusive) and max_row (exclusive)
parameters. At most 1000 rows can be requested per call.
If min_row or max_row is non-positive, the range
wraps around the most recent row. For example, to fetch the 100 most recent
rows, use min_row=-100 and max_row=0.
Permissions required: Perm_R_Transactions
:param id: Account ID - the unique identifier for the specific Account.
:type id: int
:param max_row: Maximum of the row range to return (exclusive)
:type max_row: int
:param min_row: Minimum of the row range to return (inclusive)
:type min_row: int
.. py:method:: list_transfers(account_id, before=None, limit=None)
Makes a call to GET /api/exchange/1/transfers.
Returns a list of the most recent confirmed transfers ordered from newest to
oldest.
This includes bank transfers, card payments, or on-chain transactions that
have been reflected on your account available balance.
Note that the Transfer `amount` is always a positive value and you should
use the `inbound` flag to determine the direction of the transfer.
If you need to paginate the results you can set the `before` parameter to
the last returned transfer `created_at` field value and repeat the request
until you have all the transfers you need.
This endpoint will list up to 100 transfers at a time by default.
Permissions required: Perm_R_Transfers
:param account_id: Unique identifier of the account to list the transfers from.
:type account_id: int
:param before: Filter to transfers created before this timestamp (Unix milliseconds).
The default value (0) will return the latest transfers on the account.
:type before: int
:param limit: Limit to this many transfers.
:type limit: int
.. py:method:: list_user_trades(pair, after_seq=None, before=None, before_seq=None, limit=None, since=None, sort_desc=None)
Makes a call to GET /api/1/listtrades.
Returns a list of the recent Trades for a given currency pair for this user, sorted by oldest first.
If before is specified, then Trades are returned sorted by most-recent first.
type in the response indicates the type of Order that was placed to participate in the trade.
Possible types: BID, ASK.
If is_buy in the response is true, then the Order which completed the trade (market taker) was a Bid Order.
Results of this query may lag behind the latest data.
Permissions required: Perm_R_Orders
:param pair: Filter to trades of this currency pair.
:type pair: str
:param after_seq: Filter to trades from (including) this sequence number.
Default behaviour is not to include this filter.
:type after_seq: int
:param before: Filter to trades before this timestamp (Unix milliseconds).
:type before: int
:param before_seq: Filter to trades before (excluding) this sequence number.
Default behaviour is not to include this filter.
:type before_seq: int
:param limit: Limit to this number of trades (default 100).
:type limit: int
:param since: Filter to trades on or after this timestamp (Unix milliseconds).
:type since: int
:param sort_desc: If set to true, sorts trades in descending order, otherwise ascending
order will be assumed.
:type sort_desc: bool
.. py:method:: list_withdrawals(before_id=None, limit=None)
Makes a call to GET /api/1/withdrawals.
Returns a list of withdrawal requests.
Permissions required: Perm_R_Withdrawals
:param before_id: Filter to withdrawals requested on or before the withdrawal with this ID.
Can be used for pagination.
:type before_id: int
:param limit: Limit to this many withdrawals
:type limit: int
.. py:method:: markets(pair=None)
Makes a call to GET /api/exchange/1/markets.
List all supported markets parameter information like price scale, min and
max order volumes and market ID.
:param pair: List of market pairs to return. Requesting only the required pairs will improve response times.
:type pair: list
.. py:method:: move(amount, credit_account_id, debit_account_id, client_move_id=None)
Makes a call to POST /api/exchange/1/move.
Move funds between two of your transactional accounts with the same currency
The funds may not be moved by the time the request returns. The GET method
can be used to poll for the move's status.
Note: moves will show as transactions, but not as transfers.
Permissions required: MP_None_Write
:param amount: Amount to transfer. Must be positive.
:type amount: float
:param credit_account_id: The account to credit the funds to.
:type credit_account_id: int
:param debit_account_id: The account to debit the funds from.
:type debit_account_id: int
:param client_move_id: Client move ID.
May only contain alphanumeric (0-9, a-z, or A-Z) and special characters (_ ; , . -). Maximum length: 255.
It will be available in read endpoints, so you can use it to avoid duplicate moves between the same accounts.
Values must be unique across all your successful calls of this endpoint; trying to create a move request
with the same `client_move_id` as one of your past move requests will result in a HTTP 409 Conflict response.
:type client_move_id: str
.. py:method:: post_limit_order(pair, price, type, volume, base_account_id=None, client_order_id=None, counter_account_id=None, post_only=None, stop_direction=None, stop_price=None, time_in_force=None, timestamp=None, ttl=None)
Makes a call to POST /api/1/postorder.
Warning! Orders cannot be reversed once they have executed.
Please ensure your program has been thoroughly tested before submitting Orders.
If no base_account_id or counter_account_id are specified,
your default base currency or counter currency account will be used.
You can find your Account IDs by calling the Balances API.
Permissions required: Perm_W_Orders
:param pair: The currency pair to trade.
:type pair: str
:param price: Limit price as a decimal string in units of ZAR/BTC.
:type price: float
:param type: BID for a bid (buy) limit order
ASK for an ask (sell) limit order
:type type: str
:param volume: Amount of cryptocurrency to buy or sell as a decimal string in units of the currency.
:type volume: float
:param base_account_id: The base currency Account to use in the trade.
:type base_account_id: int
:param client_order_id: Client order ID.
May only contain alphanumeric (0-9, a-z, or A-Z) and special characters (_ ; , . -). Maximum length: 255.
It will be available in read endpoints, so you can use it to reconcile Luno with your internal system.
Values must be unique across all your successful order creation endpoint calls; trying to create an order
with the same `client_order_id` as one of your past orders will result in a HTTP 409 Conflict response.
:type client_order_id: str
:param counter_account_id: The counter currency Account to use in the trade.
:type counter_account_id: int
:param post_only: Post-only Orders will be cancelled if they would otherwise have traded
immediately.
For example, if there's a bid at ZAR 100,000 and you place a post-only ask at ZAR 100,000,
your order will be cancelled instead of trading.
If the best bid is ZAR 100,000 and you place a post-only ask at ZAR 101,000,
your order won't trade but will go into the order book.
:type post_only: bool
:param stop_direction: Side of the trigger price to activate the order. This should be set if `stop_price` is also
set.
`RELATIVE_LAST_TRADE` will automatically infer the direction based on the last
trade price and the stop price. If last trade price is less than stop price then stop
direction is ABOVE otherwise is BELOW.
:type stop_direction: str
:param stop_price: Trigger trade price to activate this order as a decimal string. If this
is set then this is treated as a Stop Limit Order and `stop_direction`
is expected to be set too.
:type stop_price: float
:param time_in_force: GTC Good 'Til Cancelled. The order remains open until it is filled or cancelled by the user.
IOC Immediate Or Cancel. The part of the order that cannot be filled immediately will be cancelled. Cannot be post-only.
FOK Fill Or Kill. If the order cannot be filled immediately and completely it will be cancelled before any trade. Cannot be post-only.
:type time_in_force: str
:param timestamp: Unix timestamp in milliseconds of when the request was created and sent.
:type timestamp: int
:param ttl: Specifies the number of milliseconds after timestamp the request is valid for.
If `timestamp` is not specified, `ttl` will not be used.
:type ttl: int
.. py:method:: post_market_order(pair, type, base_account_id=None, base_volume=None, client_order_id=None, counter_account_id=None, counter_volume=None, timestamp=None, ttl=None)
Makes a call to POST /api/1/marketorder.
A Market Order executes immediately, and either buys as much of the asset that can be bought for a set amount of fiat currency, or sells a set amount of the asset for as much as possible.
Warning! Orders cannot be reversed once they have executed.
Please ensure your program has been thoroughly tested before submitting Orders.
If no base_account_id or counter_account_id are specified, the default base currency or counter currency account will be used.
Users can find their account IDs by calling the Balances request.
Permissions required: Perm_W_Orders
:param pair: The currency pair to trade.
:type pair: str
:param type: BUY to buy an asset
SELL to sell an asset
:type type: str
:param base_account_id: The base currency account to use in the trade.
:type base_account_id: int
:param base_volume: For a SELL order: amount of the base currency to use (e.g. how much BTC to sell for EUR in the BTC/EUR market)
:type base_volume: float
:param client_order_id: Client order ID.
May only contain alphanumeric (0-9, a-z, or A-Z) and special characters (_ ; , . -). Maximum length: 255.
It will be available in read endpoints, so you can use it to reconcile Luno with your internal system.
Values must be unique across all your successful order creation endpoint calls; trying to create an order
with the same `client_order_id` as one of your past orders will result in a HTTP 409 Conflict response.
:type client_order_id: str
:param counter_account_id: The counter currency account to use in the trade.
:type counter_account_id: int
:param counter_volume: For a BUY order: amount of the counter currency to use (e.g. how much EUR to use to buy BTC in the BTC/EUR market)
:type counter_volume: float
:param timestamp: Unix timestamp in milliseconds of when the request was created and sent.
:type timestamp: int
:param ttl: Specifies the number of milliseconds after timestamp the request is valid for.
If `timestamp` is not specified, `ttl` will not be used.
:type ttl: int
.. py:method:: send(address, amount, currency, account_id=None, description=None, destination_tag=None, external_id=None, forex_notice_self_declaration=None, has_destination_tag=None, is_drb=None, is_forex_send=None, memo=None, message=None)
Makes a call to POST /api/1/send.
Send assets from an Account. Please note that the asset type sent must match the receive address of the same cryptocurrency of the same type - Bitcoin to Bitcoin, Ethereum to Ethereum, etc.
Sends can be made to cryptocurrency receive addresses.
Note: This is currently unavailable to users who are verified in countries with money travel rules.
Permissions required: Perm_W_Send
:param address: Destination address or email address.
Note:
MP_None
:param address: Destination address or email address.
Note:
Perm_W_Orders
:param order_id: The Order identifier as a string.
:type order_id: str
.. py:method:: update_account_name(id, name)
Makes a call to PUT /api/1/accounts/{id}/name.
Update the name of an account with a given ID.
Permissions required: Perm_W_Addresses
:param id: Account ID - the unique identifier for the specific Account.
:type id: int
:param name: The label to use for this account
:type name: str
.. py:method:: validate(address, currency, address_name=None, beneficiary_name=None, country=None, date_of_birth=None, destination_tag=None, has_destination_tag=None, institution_name=None, is_legal_entity=None, is_private_wallet=None, is_self_send=None, memo=None, nationality=None, physical_address=None, wallet_name=None)
Makes a call to POST /api/1/address/validate.
Validate receive addresses, to which a customer wishes to make cryptocurrency sends, are verified under covering
regulatory requirements for the customer such as travel rules.
Permissions required: Perm_W_Send
:param address: Destination address or email address.
Note: