btb.libtrading package
Submodules
btb.libtrading.trading module
- synopis:
Convenience wrapper for trading functionality.
- class btb.libtrading.trading.Trading(username, password, qr_code)[source]
Bases:
objectProvides a simple stock trading API using the pyrh library. As such this library is only compatible with Robinhood accounts.
- Parameters:
- buy_dollar_amount(ticker, dollar_amount) None[source]
Places a market buy order for provided stock ticker given a dollar amount for the amount to buy.
- buy_quantity(ticker, quantity) None[source]
Places a market buy order for provided stock ticker given a quantity to buy.
- buy_with_current_funds(ticker) None[source]
Places a market buy order for provided stock ticker using the remaining account balance.
- Parameters:
ticker (str) – Stock ticker (symbol) to be purchased.
- Returns:
None.
- get_least_recently_purchased() Dict[str, float][source]
Returns Robinhood instrument ID and quantity of least recently purchased stock.
- liquidity() int[source]
Returns the integer percentage of account liquidity. e.g. If the account is worth $100 and currently has a buying power of $10 then the liquidity is 10 (10%).
- Returns:
Integer percentage of account liquidity.
- Return type:
- round_decimals_down(number: float, decimals: int = 5) float[source]
Returns a value rounded down to a specific number of decimal places.
- Parameters:
return: Round float. :rtype: float