def get_approved_addresses(network, jsonify=None): """ Allows viewing of Approved Address list. :param network: The network of the approved address. Network can be bitcoin, ethereum, bitcoincash, litecoin, zcash, or filecoin :type network: str :param jsonify: If set to false, will return the raw response object. \ If set to True, will return a dictionary parsed using the JSON format. :type jsonify: Optional[str] :returns: Returns a tuple where the first entry in the tuple is a requests reponse object \ or a dictionary parsed using the JSON format and the second entry is an error string or \ None if there was not an error. \ The keys for the dictionary are listed below. :Dictionary Keys: * approvedAddresses - Array of approved addresses on both the account and group level. -- network - The network of the approved address. Network can be bitcoin, ethereum, bitcoincash, litecoin, zcash, or filecoin -- scope - Will return the scope of the address as either "account" or "group" -- label - The label assigned to the address -- status - The status of the address that will return as "active", "pending-time" or "pending-mua". The remaining time is exactly 7 days after the initial request. "pending-mua" is for multi-user accounts and will require another administator or fund manager on the account to approve the address. -- createdAt - UTC timestamp in millisecond of when the address was created. -- address - The address on the approved address list. """ url = URLS.approved_addresses(network) payload = {"request": URLS.get_endpoint(url)} generate_signature(payload) data, err = request_post(url, payload, jsonify) return data, err
def get_account_detail(jsonify=None): """ Gets information about the profile attached to your API key. :param jsonify: If set to false, will return the raw response object. \ If set to True, will return a dictionary parsed using the JSON format. :type jsonify: Optional[str] :returns: Returns a tuple where the first entry in the tuple is a requests reponse object \ or a dictionary parsed using the JSON format and the second entry is an error string or \ None if there was not an error. \ The keys for the dictionary are listed below. :Dictionary Keys: * account - Contains information on the requested account -- accountName - The name of the account provided upon creation. Will default to Primary -- shortName - Nickname of the specific account (will take the name given, remove all symbols, replace all " " with "-" and make letters lowercase) -- type - The type of account. Will return either exchange or custody -- created - The timestamp of account creation, displayed as number of milliseconds since 1970-01-01 UTC. This will be transmitted as a JSON number * users - Contains an array of JSON objects with user information for the requested account -- name - Full legal name of the user -- lastSignIn - Timestamp of the last sign for the user. Formatted as yyyy-MM-dd'T'HH:mm:ss.SSS'Z' -- status - Returns user status. Will inform of active users or otherwise not active -- countryCode - 2 Letter country code indicating residence of user. -- isVerified - Returns verification status of user. * memo_reference_code - Returns wire memo reference code for linked bank account. """ url = URLS.account_detail() payload = {"request": URLS.get_endpoint(url)} generate_signature(payload) data, err = request_post(url, payload, jsonify) return data, err
def get_deposit_addresses(network, timestamp=None, jsonify=None): """ Gets a list of all deposit addresses. :param network: network can be bitcoin, ethereum, bitcoincash, litecoin, zcash, filecoin. :type network: str :param timestamp: Only returns addresses created on or after this timestamp. :type timestamp: Optional[str] :param jsonify: If set to false, will return the raw response object. \ If set to True, will return a dictionary parsed using the JSON format. :type jsonify: Optional[str] :returns: Returns a tuple where the first entry in the tuple is a requests reponse object \ or a list of dictionaries parsed using the JSON format and the second entry is an error string or \ None if there was not an error. \ The keys for the dictionaries are listed below. :Dictionary Keys: * address - String representation of the new cryptocurrency address. * timestamp - Creation date of the address. * label - Optional. if you provided a label when creating the address, it will be echoed back here. """ url = URLS.deposit_addresses(network) payload = {"request": URLS.get_endpoint(url)} if timestamp: payload["timestamp"] = timestamp generate_signature(payload) data, err = request_post(url, payload, jsonify) return data, err
def get_trade_volume(jsonify=None): """ Gets information about trade volume. The response will be an array of up to 30 days of trade volume for each symbol. :param jsonify: If set to false, will return the raw response object. \ If set to True, will return a dictionary parsed using the JSON format. :type jsonify: Optional[str] :returns: Returns a tuple where the first entry in the tuple is a requests reponse object \ or a dictionary parsed using the JSON format and the second entry is an error string or \ None if there was not an error. \ The keys for the dictionary are listed below. :Dictionary Keys: * symbol - The symbol. * base_currency - quantity is denominated in this currency. * notional_currency - price is denominated as the amount of notional currency per one unit of base currency. Notional values are denominated in this currency. * data_date - UTC date in yyyy-MM-dd format. * total_volume_base - Total trade volume for this day. * maker_buy_sell_ratio - Maker buy/sell ratio is the proportion of maker base volume on trades where the account was on the buy side versus all maker trades. If there is no maker base volume on the buy side, then this value is 0. * buy_maker_base - Quantity for this day where the account was a maker on the buy side of the trade. * buy_maker_notional - Notional value for this day where the account was a maker on the buy side of the trade. * buy_maker_count - Number of trades for this day where the account was a maker on the buy side of the trade. * sell_maker_base - Quantity for this day where the account was a maker on the sell side of the trade. * sell_maker_notional - Notional value for this day where the account was a maker on the sell side of the trade. * sell_maker_count - Number of trades for this day where the account was a maker on the sell side of the trade. * buy_taker_base- Quantity for this day where the account was a taker on the buy side of the trade. * buy_taker_notional - Notional value for this day where the account was a taker on the buy side of the trade. * buy_taker_count - Number of trades for this day where the account was a taker on the buy side of the trade. * sell_taker_base - Quantity for this day where the account was a taker on the sell side of the trade. * sell_taker_notional - Notional value for this day where the account was a taker on the sell side of the trade. * sell_taker_count - Number of trades for this day where the account was a taker on the sell side of the trade. """ url = URLS.trade_volume() payload = {"request": URLS.get_endpoint(url)} generate_signature(payload) data, err = request_post(url, payload, jsonify) return data, err
def get_notional_volume(jsonify=None): """ Gets information about notional volume :param jsonify: If set to false, will return the raw response object. \ If set to True, will return a dictionary parsed using the JSON format. :type jsonify: Optional[str] :returns: Returns a tuple where the first entry in the tuple is a requests reponse object \ or a dictionary parsed using the JSON format and the second entry is an error string or \ None if there was not an error. \ The keys for the dictionary are listed below. :Dictionary Keys: * date - UTC date in yyyy-MM-dd format * last_updated_ms - Unix timestamp in millisecond of the last update * web_maker_fee_bps - Integer value representing the maker fee for all symbols in basis point for web orders * web_taker_fee_bps - Integer value representing the taker fee for all symbols in basis point for web orders * web_auction_fee_bps - Integer value representing the auction fee for all symbols in basis point for web orders * api_maker_fee_bps - Integer value representing the maker fee for all symbols in basis point for API orders * api_taker_fee_bps - Integer value representing the taker fee for all symbols in basis point for API orders * api_auction_fee_bps - Integer value representing the auction fee for all symbols in basis point for API orders * fix_maker_fee_bps - Integer value representing the maker fee for all symbols in basis point for FIX orders * fix_taker_fee_bps - Integer value representing the taker fee for all symbols in basis point for FIX orders * fix_auction_fee_bps - Integer value representing the auction fee for all symbols in basis point for FIX orders * block_maker_fee_bps - Integer value representing the maker fee for all symbols in basis point for block orders * block_taker_fee_bps - Integer value representing the taker fee for all symbols in basis point for block orders * notional_30d_volume - Maker plus taker trading volume for the past 30 days, including auction volume * notional_1d_volume - A list of 1 day notional volume for the past 30 days """ url = URLS.notional_volume() payload = {"request": URLS.get_endpoint(url)} generate_signature(payload) data, err = request_post(url, payload, jsonify) return data, err
def heartbeat(jsonify=None): """ Generate a heartbeat response to keep a session alive. :returns: {"result": "ok"} """ url = URLS.heartbeat() payload = {"request": URLS.get_endpoint(url)} generate_signature(payload) data, err = request_post(url, payload, jsonify) return data, err
def check_transfers(timestamp=None, limit_transfers=10, show_completed_deposit_advances=False, jsonify=None): """ Gets a list of all transfers. :param timestamp: Only return transfers on or after this timestamp. If not present, will show the most recent transfers. :type timestamp: Optional[str] :param limit_transfers: The maximum number of transfers to return. Default is 10, max is 50. :type limit_transfers: Optional[int] :param show_completed_deposit_advances: Whether to display completed deposit advances. False by default. Must be set True to activate. :type show_completed_deposit_advances: Optional[int] :param jsonify: If set to false, will return the raw response object. \ If set to True, will return a dictionary parsed using the JSON format. :type jsonify: Optional[str] :returns: Returns a tuple where the first entry in the tuple is a requests reponse object \ or a list of dictionaries parsed using the JSON format and the second entry is an error string or \ None if there was not an error. \ The keys for the dictionaries are listed below. :Dictionary Keys: * type - Transfer type. Deposit or Withdrawal. * status - Transfer status. Advanced or Complete. * timestampms - The time that the trade was executed in milliseconds * eid - Transfer event id * advanceEid - Deposit advance event id * currency - Currency code * amount - The transfer amount * method - Optional. When currency is a fiat currency, the method field will attempt to supply ACH, Wire, or SEN. If the transfer is an internal transfer between subaccounts the method field will return Internal. * txHash - Optional. When currency is a cryptocurrency, supplies the transaction hash when available. * outputIdx - Optional. When currency is a cryptocurrency, supplies the output index in the transaction when available. * destination - Optional. When currency is a cryptocurrency, supplies the destination address when available. * purpose - Optional. Administrative field used to supply a reason for certain types of advances. """ url = URLS.transfers() payload = { "request": URLS.get_endpoint(url), "show_completed_deposit_advances": show_completed_deposit_advances } if timestamp: payload["timestamp"] = timestamp generate_signature(payload) data, err = request_post(url, payload, jsonify) return data, err
def check_available_balances(jsonify=None): """ Gets a list of all available balances in every currency. :param jsonify: If set to false, will return the raw response object. \ If set to True, will return a dictionary parsed using the JSON format. :type jsonify: Optional[str] :returns: Returns a tuple where the first entry in the tuple is a requests reponse object \ or a list of dictionaries parsed using the JSON format and the second entry is an error string or \ None if there was not an error. \ The keys for the dictionaries are listed below. :Dictionary Keys: * currency - The currency code. * amount - The current balance * available - The amount that is available to trade * availableForWithdrawal - The amount that is available to withdraw * type - "exchange" """ url = URLS.available_balances() payload = {"request": URLS.get_endpoint(url)} generate_signature(payload) data, err = request_post(url, payload, jsonify) return data, err
def withdraw_crypto_funds(currency_code, address, amount, jsonify=None): """ Before you can withdraw cryptocurrency funds to an approved address, you need three things: 1. You must have an approved address list for your account 2. The address you want to withdraw funds to needs to already be on that approved address list 3. An API key with the Fund Manager role added :param currency_code: the three-letter currency code of a supported crypto-currency, e.g. btc or eth. :type currency_code: str :param address: Standard string format of cryptocurrency address. :type address: str :param amount: Quoted decimal amount to withdraw. :type amount: str :param jsonify: If set to false, will return the raw response object. \ If set to True, will return a dictionary parsed using the JSON format. :type jsonify: Optional[str] :returns: Returns a tuple where the first entry in the tuple is a requests reponse object \ or a dictionary parsed using the JSON format and the second entry is an error string or \ None if there was not an error. \ The keys for the dictionary are listed below. :Dictionary Keys: * address - Standard string format of the withdrawal destination address. * amount - The withdrawal amount. * txHash - Standard string format of the transaction hash of the withdrawal transaction. Only shown for ETH and GUSD withdrawals. * withdrawalID - A unique ID for the withdrawal. Only shown for BTC, ZEC, LTC and BCH withdrawals. * message - A human-readable English string describing the withdrawal. Only shown for BTC, ZEC, LTC and BCH withdrawals. """ url = URLS.withdrawl_crypto(currency_code) payload = { "request": URLS.get_endpoint(url), "address": address, "amount": amount } generate_signature(payload) data, err = request_post(url, payload, jsonify) return data, err