def gen_spreads2(expiries=None):

	gen = SpreadGen()
#	expiration_date = datetime.datetime(2013,10,11)

	spy = live_yahoo.get_symbol_price("SPY")
	available_dates = [x.expiration_date() for x in live_yahoo.main()]
	available_spreads = reduce(operator.add, [spread_for_today(gen, expiry, datetime.datetime.today(), spy) for expiry in available_dates])
	gen.print_spread(available_spreads)
	def __init__(self):
		self.vix = load_prices("^VIX")
		self.spy = load_prices("SPY")
		self.returns = load_returns()

		self.failure_model = chance_of_failure_model(self.vix, self.returns)
		self.linear_return = linear_return(self.vix, self.returns)

		todays_vix = live_yahoo.get_symbol_price("VIX")
		#shove this in there to get up to the minute (er, 20 minutes) readings
		#NOTE: this isn't completely statistically valid
		self.vix.vixdays[-1].close = todays_vix
Пример #3
0
def gen_spreads2(expiries=None):

    gen = SpreadGen()
    #	expiration_date = datetime.datetime(2013,10,11)

    spy = live_yahoo.get_symbol_price("SPY")
    available_dates = [x.expiration_date() for x in live_yahoo.main()]
    available_spreads = reduce(operator.add, [
        spread_for_today(gen, expiry, datetime.datetime.today(), spy)
        for expiry in available_dates
    ])
    gen.print_spread(available_spreads)
Пример #4
0
    def __init__(self):
        self.vix = load_prices("^VIX")
        self.spy = load_prices("SPY")
        self.returns = load_returns()

        self.failure_model = chance_of_failure_model(self.vix, self.returns)
        self.linear_return = linear_return(self.vix, self.returns)

        todays_vix = live_yahoo.get_symbol_price("VIX")
        #shove this in there to get up to the minute (er, 20 minutes) readings
        #NOTE: this isn't completely statistically valid
        self.vix.vixdays[-1].close = todays_vix
	def print_spread(self, spread, top=3):

		if len(spread) == 0:
			print "No valid trades for quote date"
			return

		print "Average Return is " + str(numpy.mean([x[0] for x in spread]))
		results = sorted(spread, key=lambda x:x[0], reverse=True)
		todays_spy = live_yahoo.get_symbol_price("SPY")

		for r in results[:top]:
			sp = spread_percent = r[1].body_spread / 100.0
			print "Expiration date", r[1].expiration_date
			print "Body spread " + str(r[1].body_spread)
			print "Wingspan " + str(r[1].wingspan)
			print "Sell call spread at {0}\n with spread at {1},\n sell put spread at {2}\n with spread at {3},\n expected return {4}".format(round(todays_spy * (1.0 + sp)),
				 													  round((todays_spy * (1.0 + sp)) + r[1].wingspan),
																	  round(todays_spy * (1.0 - sp)),
																	  round((todays_spy * (1.0 - sp)) - r[1].wingspan),
																	  r[0])
Пример #6
0
    def print_spread(self, spread, top=3):

        if len(spread) == 0:
            print "No valid trades for quote date"
            return

        print "Average Return is " + str(numpy.mean([x[0] for x in spread]))
        results = sorted(spread, key=lambda x: x[0], reverse=True)
        todays_spy = live_yahoo.get_symbol_price("SPY")

        for r in results[:top]:
            sp = spread_percent = r[1].body_spread / 100.0
            print "Expiration date", r[1].expiration_date
            print "Body spread " + str(r[1].body_spread)
            print "Wingspan " + str(r[1].wingspan)
            print "Sell call spread at {0}\n with spread at {1},\n sell put spread at {2}\n with spread at {3},\n expected return {4}".format(
                round(todays_spy * (1.0 + sp)),
                round((todays_spy * (1.0 + sp)) + r[1].wingspan),
                round(todays_spy * (1.0 - sp)),
                round((todays_spy * (1.0 - sp)) - r[1].wingspan), r[0])