import argparse from collections import defaultdict from datetime import datetime from decimal import Decimal from math import ceil from dateutil.parser import parse import pytz from robinhood.exceptions import NotFound from robinhood.RobinhoodCachedClient import RobinhoodCachedClient, FORCE_LIVE from robinhood.util import get_last_id_from_url, DIRECTION_TO_ORDER_SIDE client = RobinhoodCachedClient() client.login() def display_pending_options_orders(): orders = client.get_options_orders() pending_orders = [order for order in orders if order['state'] in ['queued', 'confirmed']] if len(pending_orders) == 0: print('\tNo pending orders') exit() chain_ids = [order['chain_id'] for order in pending_orders] chains = client.get_options_chains(chain_ids=chain_ids) chain_by_id = { chain['id']: chain for chain in chains }
#!/usr/bin/env python3 import argparse import json from robinhood.RobinhoodCachedClient import RobinhoodCachedClient, FORCE_LIVE # Set up the client client = RobinhoodCachedClient() client.login() def cancel_orders(order_ids): print('') print('!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!') confirm = input('Cancel {} order{}? [N/y] '.format( len(order_ids), 's' if len(order_ids) > 1 else '')) if confirm not in ['y', 'yes']: print('Bailed out!') exit() for order_id in order_ids: cancelled_order = client.cancel_order(order_id) print('Cancelled order {}'.format(order_id)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Cancel orders') parser.add_argument('order_ids', nargs='*', help='The order ids to cancel') args = parser.parse_args()
#!/usr/bin/env python3 import argparse import json from robinhood.RobinhoodCachedClient import RobinhoodCachedClient, FORCE_LIVE # Set up the client client = RobinhoodCachedClient() client.login() def cancel_options_orders(order_ids): print('') print('!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!') confirm = input('Cancel {} order{}? [N/y] '.format( len(order_ids), 's' if len(order_ids) > 1 else '')) if confirm not in ['y', 'yes']: print('Bailed out!') exit() for order_id in order_ids: cancelled_order = client.cancel_options_order(order_id) print('Cancelled order {}'.format(order_id)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Cancel options orders') parser.add_argument('order_ids', nargs='*',
#!/usr/bin/env python3 import argparse import json from robinhood.RobinhoodCachedClient import RobinhoodCachedClient, FORCE_LIVE # Set up the client client = RobinhoodCachedClient() client.login() SMS = 'sms' APP = 'app' def enable_mfa(mfa_source): if mfa_source == APP: request_mfa_details = client.request_app_mfa() totp_token = request_mfa_details['totp_token'] print('Your time-based one-time password token is: {}'.format( totp_token)) otp = input( "After entering into your app, please enter a one time code: ") verify_details = client.verify_app_mfa(otp) elif mfa_source == SMS: phone_number = input( "What phone number would you like to receive for MFA codes? ") sms_details = client.request_sms_mfa(phone_number) print('You should be getting a code sent to {}'.format( sms_details['phone_number']))
#!/usr/bin/env python3 from robinhood.RobinhoodCachedClient import RobinhoodCachedClient client = RobinhoodCachedClient() client.logout() print('Logged out!')
#!/usr/bin/env python3 import argparse import json from robinhood.RobinhoodCachedClient import RobinhoodCachedClient, FORCE_LIVE # Set up the client client = RobinhoodCachedClient() client.login() def cancel_crypto_orders(order_ids): print('') print('!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!') confirm = input('Cancel {} order{}? [N/y] '.format( len(order_ids), 's' if len(order_ids) > 1 else '')) if confirm not in ['y', 'yes']: print('Bailed out!') exit() for order_id in order_ids: cancelled_order = client.cancel_crypto_order(order_id) print('Cancelled order {}'.format(order_id)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Cancel crypto orders') parser.add_argument('order_ids', nargs='*', help='The crypto order ids to cancel')