Skip to content

Commit

Permalink
Add configuration for max quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
ttt733 committed Jan 25, 2019
1 parent 78d1089 commit 151cfc6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tick_taker.py
Expand Up @@ -4,10 +4,6 @@
import alpaca_trade_api as tradeapi


# The maximum number of shares we'll hold at once for the symbol
max_shares = 500


class Quote():
"""
We use Quote objects to represent the bid/ask spread. When we encounter a
Expand Down Expand Up @@ -114,6 +110,7 @@ def update_total_shares(self, quantity):

def run(args):
symbol = args.symbol
max_shares = args.quantity
opts = {}
if args.key_id:
opts['key_id'] = args.key_id
Expand Down Expand Up @@ -241,7 +238,11 @@ async def on_trade_updates(conn, channel, data):
parser = argparse.ArgumentParser()
parser.add_argument(
'--symbol', type=str, default='SNAP',
help='symbol you want to trade'
help='Symbol you want to trade.'
)
parser.add_argument(
'--quantity', type=int, default=500,
help='Maximum number of shares to hold at once. Minimum 100.'
)
parser.add_argument(
'--key-id', type=str, default=None,
Expand All @@ -256,4 +257,5 @@ async def on_trade_updates(conn, channel, data):
help='set https://paper-api.alpaca.markets if paper trading',
)
args = parser.parse_args()
assert args.quantity >= 100
run(args)

0 comments on commit 151cfc6

Please sign in to comment.