Skip to content

Commit 6d9f444

Browse files
committed
linting on feature branch
1 parent 81b6b03 commit 6d9f444

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pythonic_schwab_api/algo_example_script.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ def find_trades_from_quotes(quotes):
120120

121121

122122
def sell_the_algo_buys(orders_api, account_hash, quotes_api):
123+
"""
124+
Sells the stocks that were bought by the algorithm if certain conditions are met.
125+
126+
Args:
127+
orders_api (Orders): The Orders API instance.
128+
account_hash (str): The account hash.
129+
quotes_api (Quotes): The Quotes API instance.
130+
"""
123131
# Check order statuses and handle new trades
124132
try:
125133
with open(f"algo_trades_{orders_api.client.config.initials}.json", "r", encoding="utf-8") as f:
@@ -165,13 +173,26 @@ def sell_the_algo_buys(orders_api, account_hash, quotes_api):
165173

166174

167175
def check_cash_account(account_api, account_hash):
176+
"""
177+
Checks if the account is a cash account.
178+
179+
Args:
180+
account_api (Accounts): The Accounts API instance.
181+
account_hash (str): The account hash.
182+
183+
Returns:
184+
bool: True if the account is a cash account, False otherwise.
185+
"""
168186
account = account_api.get_account(account_hash=account_hash, fields="positions")
169187
# print(account)
170188
cash_account = account["securitiesAccount"]["type"] == "CASH"
171189
return cash_account
172190

173191

174192
def main():
193+
"""
194+
Main function to run the trading algorithm.
195+
"""
175196
# Initialize client
176197
client = APIClient(initials=input("Enter your initials: "))
177198
accounts_api = Accounts(client)

0 commit comments

Comments
 (0)