Submitted a Billion Dollar Algo

I just submitted an algorithm that turns 1 million into 25 million over seven years, 2500%. If I don't get an allocation, I will have no choice but to conclude that this site a complete sham, and is simply built to capture ideas and waste good programmer's time. I have saved all my code locally, as well, and will be manually trading my personal account using this strategy, obviously keeping it to myself. The algorithm met all the specifications, and performed even better during market recessions, failing to lose a single cent in 2008 and 2012. Clearly, any investor with half a brain would flock to this like a swarm of bees. Obviously, it's not the attached, but I had to use something else, given you can't post without an attachment, or even so much as add an image. I am very curious to see how this plays out:

Total Returns
2578.89% - 26 million

Benchmark Returns
131.02%

Alpha
0.54

Beta
-0.24

Sharpe
2.47

Sortino
4.30

Volatility
0.21

Max Drawdown
-21.6%

61 responses

Very impressive, I always wonder what I did wrong when I get performance like this :D.

Did you run this with 10M capital and volume and price slippage enabled? Dollar-neutral? What's the OOS period?

Hi L. Williams , if i were really like you and can figure out an algo which turns 1M to 25M in 7 years, i would rather trade on my own instead of joining quantopian allocation competition. By the way, is your algo trading VIX-related derivatives (e.g. VIX, VXX, XIV) ?

@LW While likely something there, an investor would want to know how much was actually invested as initial capital is merely a goal yet is used in calculating returns (and metrics). This extreme example is really just 8%. You can use the function in this to keep track of maximum amount invested, risked.

320
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
'''

An example of illusory profit.
The apparent returns are just margin.

To make the returns curve as close to actual as possible,
try to invest as close as possible to the initial capital,
unlike this example.

'''

def initialize(context):

for i in range(1, 391):

break      # comment/remove to activate and chart what's really happening

schedule_function(pvr, date_rules.every_day(), time_rules.market_open(minutes=i))

order(sid(8554), 4000)

def pvr(context, data):
''' Custom chart and/or logging of profit_vs_risk returns and related information
https://www.quantopian.com/posts/pvr
'''
import time
from datetime import datetime
from pytz import timezone      # Python will only do once, makes this portable.
#   Move to top of algo for better efficiency.
c = context  # Brevity is the soul of wit -- Shakespeare [for readability]
if 'pvr' not in c:

# For real money, you can modify this to total cash input minus any withdrawals
manual_cash = c.portfolio.starting_cash
time_zone   = 'US/Pacific'   # Optionally change to your own time zone for wall clock time

c.pvr = {
'options': {
# # # # # # # # # #  Options  # # # # # # # # # #
'logging'         : 0,    # Info to logging window with some new maximums
'log_summary'     : 126,  # Summary every x days. 252/yr

'record_pvr'      : 1,    # Profit vs Risk returns (percentage)
'record_pvrp'     : 0,    # PvR (p)roportional neg cash vs portfolio value
'record_cash'     : 0,    # Cash available
'record_max_lvrg' : 1,    # Maximum leverage encountered
'record_max_risk' : 1,    # Highest risk overall
'record_shorting' : 0,    # Total value of any shorts
'record_max_shrt' : 0,    # Max value of shorting total
'record_cash_low' : 1,    # Any new lowest cash level
'record_q_return' : 0,    # Quantopian returns (percentage)
'record_pnl'      : 0,    # Profit-n-Loss
'record_risk'     : 0,    # Risked, max cash spent or shorts beyond longs+cash
'record_leverage' : 0,    # End of day leverage (context.account.leverage)
# All records are end-of-day or the last data sent to chart during any day.
# The way the chart operates, only the last value of the day will be seen.
# # # # # # # # #  End options  # # # # # # # # #
},
'pvr'        : 0,      # Profit vs Risk returns based on maximum spent
'cagr'       : 0,
'max_lvrg'   : 0,
'max_shrt'   : 0,
'max_risk'   : 0,
'days'       : 0.0,
'date_prv'   : '',
'date_end'   : get_environment('end').date(),
'cash_low'   : manual_cash,
'cash'       : manual_cash,
'start'      : manual_cash,
'tz'         : time_zone,
'begin'      : time.time(),  # For run time
'run_str'    : '{} to {}  ${} {} {}'.format(get_environment('start').date(), get_environment('end').date(), int(manual_cash), datetime.now(timezone(time_zone)).strftime("%Y-%m-%d %H:%M"), time_zone) } if c.pvr['options']['record_pvrp']: c.pvr['options']['record_pvr'] = 0 # if pvrp is active, straight pvr is off if get_environment('arena') not in ['backtest', 'live']: c.pvr['options']['log_summary'] = 1 # Every day when real money log.info(c.pvr['run_str']) p = c.pvr ; o = c.pvr['options'] ; pf = c.portfolio pnl = pf.portfolio_value - p['start'] def _pvr(c): p['cagr'] = ((pf.portfolio_value / p['start']) ** (1 / (p['days'] / 252.))) - 1 ptype = 'PvR' if o['record_pvr'] else 'PvRp' log.info('{} {} %/day cagr {} Portfolio value {} PnL {}'.format(ptype, '%.4f' % (p['pvr'] / p['days']), '%.3f' % p['cagr'], '%.0f' % pf.portfolio_value, '%.0f' % pnl)) log.info(' Profited {} on {} activated/transacted for PvR of {}%'.format('%.0f' % pnl, '%.0f' % p['max_risk'], '%.1f' % p['pvr'])) log.info(' QRet {} PvR {} CshLw {} MxLv {} MxRisk {} MxShrt {}'.format('%.2f' % (100 * pf.returns), '%.2f' % p['pvr'], '%.0f' % p['cash_low'], '%.2f' % p['max_lvrg'], '%.0f' % p['max_risk'], '%.0f' % p['max_shrt'])) def _minut(): dt = get_datetime().astimezone(timezone(p['tz'])) return str((dt.hour * 60) + dt.minute - 570).rjust(3) # (-570 = 9:31a) date = get_datetime().date() if p['date_prv'] != date: p['date_prv'] = date p['days'] += 1.0 do_summary = 0 if o['log_summary'] and p['days'] % o['log_summary'] == 0 and _minut() == '100': do_summary = 1 # Log summary every x days if do_summary or date == p['date_end']: p['cash'] = pf.cash elif p['cash'] == pf.cash and not o['logging']: return # for speed shorts = sum([z.amount * z.last_sale_price for s, z in pf.positions.items() if z.amount < 0]) new_key_hi = 0 # To trigger logging if on. cash = pf.cash cash_dip = int(max(0, p['start'] - cash)) risk = int(max(cash_dip, -shorts)) if o['record_pvrp'] and cash < 0: # Let negative cash ding less when portfolio is up. cash_dip = int(max(0, cash_dip * p['start'] / pf.portfolio_value)) # Imagine: Start with 10, grows to 1000, goes negative to -10, should not be 200% risk. if int(cash) < p['cash_low']: # New cash low new_key_hi = 1 p['cash_low'] = int(cash) # Lowest cash level hit if o['record_cash_low']: record(CashLow = p['cash_low']) if c.account.leverage > p['max_lvrg']: new_key_hi = 1 p['max_lvrg'] = c.account.leverage # Maximum intraday leverage if o['record_max_lvrg']: record(MxLv = p['max_lvrg']) if shorts < p['max_shrt']: new_key_hi = 1 p['max_shrt'] = shorts # Maximum shorts value if o['record_max_shrt']: record(MxShrt = p['max_shrt']) if risk > p['max_risk']: new_key_hi = 1 p['max_risk'] = risk # Highest risk overall if o['record_max_risk']: record(MxRisk = p['max_risk']) # Profit_vs_Risk returns based on max amount actually invested, long or short if p['max_risk'] != 0: # Avoid zero-divide p['pvr'] = 100 * pnl / p['max_risk'] ptype = 'PvRp' if o['record_pvrp'] else 'PvR' if o['record_pvr'] or o['record_pvrp']: record(**{ptype: p['pvr']}) if o['record_shorting']: record(Shorts = shorts) # Shorts value as a positve if o['record_leverage']: record(Lv = c.account.leverage) # Leverage if o['record_cash'] : record(Cash = cash) # Cash if o['record_risk'] : record(Risk = risk) # Amount in play, maximum of shorts or cash used if o['record_q_return']: record(QRet = 100 * pf.returns) if o['record_pnl'] : record(PnL = pnl) # Profit|Loss if o['logging'] and new_key_hi: log.info('{}{}{}{}{}{}{}{}{}{}{}{}'.format(_minut(), ' Lv ' + '%.1f' % c.account.leverage, ' MxLv ' + '%.2f' % p['max_lvrg'], ' QRet ' + '%.1f' % (100 * pf.returns), ' PvR ' + '%.1f' % p['pvr'], ' PnL ' + '%.0f' % pnl, ' Cash ' + '%.0f' % cash, ' CshLw ' + '%.0f' % p['cash_low'], ' Shrt ' + '%.0f' % shorts, ' MxShrt ' + '%.0f' % p['max_shrt'], ' Risk ' + '%.0f' % risk, ' MxRisk ' + '%.0f' % p['max_risk'] )) if do_summary: _pvr(c) if get_datetime() == get_environment('end'): # Summary at end of run _pvr(c) ; elapsed = (time.time() - p['begin']) / 60 # minutes log.info( '{}\nRuntime {} hr {} min'.format(p['run_str'], int(elapsed / 60), '%.1f' % (elapsed % 60)))  There was a runtime error. You certainly phrased that provocatively . . . Six months from today, you should run the exact same code but through a different time period, ending April 16, 2018. Then check the beta, sharpe, etc. for the 6 months between today and that date. If they match the earlier periods, then yes indeed it will be an interesting algorithm. The default assumption on any backtest is that it was overfit (unintentionally, in most cases). If it continues to perform with out-of-sample data, that helps to disprove the original assumption. Disclaimer The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. "O Ye of Little Faith" Seriously, Dan. I'm glad you said that. I entered the contest. It started running it today. On$10,000,000, it made $41,907.66 on the first day. It's legit. See for yourself, I pasted the image below. I'm just looking for an allocation to get away from IT man. That's all I want. I'll take 10%. http://www.titlelight.com/images/capture.png I just updated the image below removing any details on what was traded as well as any price info. I've run this thing as far back as you can go. Not one year has it lost money, and not one year has it lost to the S&P500. In fact, you can barely see it, because it's way below the return this algorithm produces. I know it sounds hard to believe, and I'm not making any of this up. When I was young, I refused to pay attention in school. My mother thought I should see a shrink. They gave me an IQ test and found out that I had an IQ that was off the charts. So, high in fact, they retested. I'm not saying this to brag, but these sort of things come naturally to me. Numbers, finance, math, science. I don't think about the world and the universe the way normal people do. I'm just weird like that. I found Quantopian and I became addicted. The mere audacity that people would think that the Market could not be beaten was enough to keep me up at night. I'm composed dozens of algorithms. And I almost gave up. And it wasn't until I was actually fasting, that one night I decided to go back and fool around. Most people don't believe in God, but there was something different about this night. I actually made a mistake in my code and when I saw the numbers, I couldn't believe it. That was the first truly successful algorithm I wrote. It turned 10,000 into 4.9 million from 2010 - 2017. However, it couldn't scale to handle large sums. I noticed the higher I went, the worse it performed. It capped out at 1 million. So, I had to do something different. That's when I created this. That's when the ideas started streaming and I figured out how to beat all the markets, with large sums of capital using a combination of fundamental and technical analysis, along with good old fashion common sense. I will post the stats from the Algorithm daily if you like, but I know I'm right because, even with the first algorithm I created, I've emulated it in IB, and it works like nothing I've ever seen. You will believe. I just hope that you guys are who you say you are. Sorry about the image links. That's a site I'm working on and I used shared SSL Security. I uploaded the images to another site I'm coding. To answer the questions above, it never uses leverage greater than one. It's not trading VIX derivatives. And it would be wrong to assume that I made a mistake. I've made many in my life, but that is not the case here. Also, it easily scales to 10,000,000 using the default slippage, as you can see in the image I posted. And it should not be beyond anyone's capacity to entertain the thought that someone could write a better algorithm. The human mind is a marvelous universe in and of itself, capable of incredible feats, to those who believe. Now, Dan if you can, please go and tell Mr. Fawcett that I found his golden goose, and I am humbly requesting my ten percent allocation that he promised. If he's a millionaire, I just made him a billionaire. Anyway. Hopefully, I answered all your questions. I just submitted my code as literary copyright works. If I'm not able to get an allocation on this platform, in accordance with what's stated in the terms, I'm quite sure I can use it elsewhere, if not just for my own personal purposes. I downloaded the IB API docs and began testing them with the artificial intelligence engine I developed for trading. So again, we'll see how this pans out. 122,000 in two days on 10,00,000. Please do keep us updated every day. I'm keeping my popcorn by the laptop. Don't you think quantopian will have access to your code or might have already gone through it by now? I copyrighted the code as a literary work. If someone does steal it, they better keep it under wraps. A 26 million dollar algorithm stolen is enough damages to completely destroy Quantopian, not to mention potentially landing people in prison. I don't think they would do that. It's just flat out stupid. Besides, they would make more money by paying me the 10% on an allocation and farming it out to their clients. Worse my sister owns a law firm specializing in corporate law. The only motivation for stealing would be sheer unadulterated greed. I have to think that Mr. Fawcett is far more intelligent than that. He seems like a guy with a bright mind, because this platform was one hell of an idea. I just wish I could turn this thing loose on my account. Doesn't copyrighting the work mean that you simultaneously make it available to the public? I know that's the case with patents, and I don't see how people could know not to infringe on your work unless it was made so. Despite what the majority of people seem to think, I don't believe Quantopian would ever violate the trust of the users. They very clearly state that the IP of users algorithms belong to them, and that they will only perform tests on it - never look at the code. To my knowledge there is no proof that this is not the case, not to mention that the future of the whole platform hinges on that trust. Which brings me to my question; why do you think copyrighting the code is necessary, or even a good idea? Seems to me that the best course of action would to just keep it a secret and wait for an allocation or trade it yourself. Quick sidenote: Why do you estimate the algo's value at 26 million? Or did you mean something else by that? I've already copy written both my algorithms as literary works. The notion that you would question why seems somewhat ridiculous. I would ask you to pose the same question to Bill Gates, and gauge his reaction. Better yet, do you think a Quant who worked for Goldman and decided to take a formula to another company wouldn't be held liable for damages? I think the answer is obvious. I agree with you that I don't think that Quantopian would do that. It simply doesn't make logical sense, based on what I stated in conjunction with what you stated. As far as the value is concerned, that would be up to a court to decide. However, if we take the platform at face value, and assume Quantopian's back testing mechanism is as accurate they tout it to be, if an Algorithm can take a million dollar account and turn that into a 26 million dollar account, in six years, beating the S&P500 by thousands of percentage points, it would be worth far in excess of 26 million dollars. Large institutions pay millions of dollars for far less return on capital. Most investors are lucky if they make 6%, and they sure as hell would never make 207% during the crash of 2008. The greatest investor in the world, Warren Buffett, is happy with 10%. It's been two days and we're at over 100,000 on 10,000,000. 300,000 in three days in the contest. Hi Leo, i'm just a humble engineer, happily retired, who has been trading as a hobby for a long time and now enjoying being able to do it without my former "day job" (with all its accompanying idiot clients and egotistical, over-aggressive kiddie managers to annoy me any more). I'm no genius, maybe I'm not actually all that smart, in fact I can barely even program in python. However i did work in the corporate world for a long time, mostly in a fairly tough industry, and in all sorts of "interesting" (!!) places around the world. So, I do have at least a tiny little bit of "street smarts". Maybe I'm a bit crazy to believe that the traders' "holy grail" exists, and even more so to believe that you have actually found it. However IF you have, then I would like to offer you a valuable suggestion (call it advice if you will) for which I want nothing at all in return. Here it is: "Take good care of yourself and think very carefully about what you do and how you do it". That's all. Do I need to explain? I assume that you are probably from and/or live in the US. You are now making yourself visible in the bigger world. In fact you are already visible. Most of the rest of the world works by a different set of rules (if any at all) compared to what you are probably used to. Copyrights will not protect you. Having a family member who is a lawyer will not protect you. Having a firewall and anti-malware program on your computer will not protect you. The concept of "IP" will not protect you. I'm not talking here about having to worry about Quantopian (who I believe are good people), but about other organizations and even governments who are not very nice. My wife "lost" four friends & colleagues several years ago. Do you understand what I mean? I do not wish to go into details. Those people were not talking about big money in the way that you are now. All they were doing was working as human rights lawyers & journalists in a country that is (supposedly) democratic, but which I do not wish to name. I assume you are a good person and an honest person, and I believe the same of the people at Quantopian. But you are already making yourself visible to all sorts of other people. Please be careful who you choose to play with. Sincere best wishes to you. I'm already experiencing what you are talking about. I've been getting a slew of calls from fake recruiters and people asking me for my address information. I even took down my linkedin and created another one when some french weirdo suggested he and I have a talk with no one else present. I've had a guy who supposedly wanted me for a programming Job at a Nuclear facility, ask to meet me at a Starbucks. I've had people asking me to trade their money for them. I've had people wanting to meet me out of the blue. I've even found rogue software programs popping up on my computer, which I've had to block and uninstall. You are right. We live in a really sick world, full of sick people. I truly hope that Quantopian comes through. I honestly regret having said anything. Thank you for your advice. I truly appreciate it. Being blessed by God with intellect can be both a curse and a blessing. Being able to make people rich isn't always a good thing. I sent John Fawcett and email. I haven't heard anything back. Again, I wish I had just kept this to myself and not said anything. 1,000,000 in four days in the contest. OMG!!! I created a financial time bomb! Where in God's name is Mr. Fawcett. He should be kicking my door down to talk to me. I hope you are trading with some real money as well in some other account. Yes, I am. Made 2000 in two days on 10k. I went long on BLFS. The program I wrote detected an FDA approval and spoke out loud to me. I got in the move at 6.56. That's because my program processes thousands of rss feeds and strips out what I've defined for it to detect. I'm going through the IB API now to have it place the orders for me in ASP.net. Fastest gun in the east. Lol. And if you thought I was joking..... https://www.youtube.com/watch?v=wvoax1Ow-Pk If I had an actually day trading account, I would have reversed position at the open for 500, and bought at resistance at 6.50, then reversed positions again at 7.50 where I sold, for a grand total of$2500. I'm going to decimate the market this year. It's not even fair.

That's nice, so once IB is in place you have a fully automated system.

That is correct. $kywalker will issue the trades while I sleep. He detects earnings as soon as they hit and calls them out, telling me "Earnings beat detected." He can give me all gaps if I ask him, all stocks in an oversold condition, all moving average crossovers, everything a trader could dream of,$kywalker can do it. I thought it was funny given my avatar. So I named it Loot $kywalker. "Loot, I am father!", Like literally though, I coded him. And the best part is that he knows the conditions for my algorithms. So, he can simulate everything I've done on this platform, and he can see the spreads as well. Whereas you can't see them in here. I don't know why this Fawcett guy keeps dragging his feet. Maybe, I should go to Goldman and talk to them, if I don't hear back. This is crazy. Like, at what point do you just get it. You ask us to come on here and build you what amounts to Midas, and then you don't even respond to my emails. Nice! Just watched your video, so based on the news rss feeds your program will suggest either to buy/sell ? Correct! Here is the shell code for IB. Here you have full control. You can pretty much do anything. I'll test this against my test account and ensure nothing crazy happens for about 30 days. Then if all is Kosher, I will fully simulate what I've done here on Quantopian by merging the logic into the C# program. Then I'll slap on an interface, and and call it, "The last Jedi!" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Threading; using System.Net; using System.Net.Sockets; using System.IO; // Use the Interactive Brokers "IBApi" using IBApi; namespace IB_Real_Time_Console_CS { class Program { static void Main(string[] args) { Samples.EWrapperImpl ibClient = new Samples.EWrapperImpl(); ibClient.ClientSocket.eConnect("127.0.0.1", 7496, 0); var reader = new EReader(ibClient.ClientSocket, ibClient.Signal); reader.Start(); new Thread(() => { while (ibClient.ClientSocket.IsConnected()) { ibClient.Signal.waitForSignal(); reader.processMsgs(); } }) { IsBackground = true }.Start(); while (ibClient.NextOrderId <= 0) { } Contract contract = new Contract(); contract.Symbol = "IBM"; contract.SecType = "STK"; contract.Exchange = "SMART"; contract.Currency = "USD"; List<TagValue> mktDataOptions = new List<TagValue>(); ibClient.ClientSocket.reqPositions(); Console.ReadKey(); ibClient.ClientSocket.cancelMktData(1); ibClient.ClientSocket.eDisconnect(); } } }  Since,$kywalker will be voice activated, I can simply code a function to pass the args into the program, saying something like "Buy at the bid", and he will launch the program with the arguments and initiate the trade, and you will literally here IB say "Oder filled" or "Order partially filled", almost like two people talking. Technology is a beautiful thing.

1.1 Million now in the contest. Still no word from Mr. Fawcett. I just looked at the leaderboard. All I see are names like Sky Blue, Jungle Green Buffalo, and Bronze Butterfly. I'm assuming those are aliases. Quantconnect does something similar when you spin up a back test. It says I'm currently in 356th place. Lmao!!! 10% in three days. I had no idea Quantopian entertained such genius. Let's see where we are after a month. At this rate, in this bull market, it will have doubled the total. If I don't win this contest, this site is a total HOAX! The Sharpe on the algo is at 13.33. I'm very interested in their scoring system, which current places me at a 70. Seriously??? I want to pose a question to everyone on this platform. What are the odds that 386 people have created algorithms that have made sums in excess of 1.1 million on 10 million over the course of the contest with a Sharpe of 13.33? My expectation is this should have at least jumped into the top 10, given it's returns. Call me paranoid, but do I sound logical? My spider sense is tingling right now.

Leo,
At the Singapore Quantcon recently, Delaney Mackenzie was urging people to look at something other than price data, which of course is very good advice, but here was I, wondering just how much benefit could REALLY be derived from using "alternative data"?

Well, you are demonstrating what can potentially be done right now, and its incredible! If people at Quantopian seem a bit slow to respond, I'm quite sure its not at all because they are "hoaxing" you in any way. More likely you have just completely "knocked their sox off" and they are simply speechless at seeing something so amazing! Heartiest congratulations to you on "doing the impossible"!!!

Does your algorithm have any short positions? In capture7.jpg short exposure number is $0.00, is that just temporary figure? As stated in rules here: https://www.quantopian.com/open/rules Judging Your algorithm must be hedged to the market. It should hold both long and short positions simultaneously, or be entirely in cash. I don't want to divulge what I'm doing in any respect Mikko. And to Tony, I am not bronze butterfly. I just deployed my algo three days ago. It's moved to the middle of the pack. I'm assuming these guys have been running for a bit longer, but I do fully expect to hawk down every single one of these guys. With a Sharpe of almost 14, and a 10% gain in three days on 10 million, at this pace, no way in hell I can see anyone of them winning. What Quantopian should do to prove it is indeed fully transparent, and isn't completely full of horse manure, is print the stats from each algorithm as the contest progresses. I'd be interested to see, who has made more than 1 a million on 10 and in what span of time. Their names aren't printed either. Those are aliases. It says so when you drill in. Either way, I'm working on something much bigger with the IB API. If Fawcett won't give me my allocation, I'm gonna make the money either way. I also have to entertain the thought that some of these guys may actually be that smart. It's not impossible. However, it would be more believable if Quantopian didn't operate in this cloak of secrecy. For all we know, that list may be full of fake names, and simply engineered to have people believe narrative, so they can grab their intellectual property. I understand the aliases. I do not understand why we cannot see, at the very least, the metrics generated by the algorithms, to ensure we are not be lied to or scammed. That doesn't pass the honesty and transparency smell test. The list also hasn't been updated in 20 hours. So a few hours from now, it will register the additional 9%. That may spark the move I'm looking for. We'll see. I stand corrected. You can see the returns. They had to use scientific notation to show the returns because the box wasn't big enough, but you won't believe this. Get a load of this.... www.titlelight.com/images/me.jpg www.titlelight.com/images/leader.jpg - Bronze Butterfly I'm not going to dare say what I'm thinking. I'll let you do the math. :-)) Lol. Indeed it will. Long term beta is 0.14. I suppose then it does a daily evaluation and punishes those who capitalize on a bullish market. So huge gains on days when the Market does well, lowers your score. Brilliant logic. We should all code our algorithms then to be conservative with its gains as the DOW climbs to new heights, rather than capitalize on the markets momentum. I guess somehow we deem that conducive to investment goals. @LW Could you paste this at the end of initialize() and report its last value? I'm hampered not knowing how you are ordering, whether day trades and when leverage was being recorded. If this turns out well it'll be impressive as metrics with only a few data points can be wild while this from a backtest says a great deal. Thanks.  context.mxlv = 0 for i in range(1, 391): schedule_function(mxlv, date_rules.every_day(), time_rules.market_open(minutes=i)) def mxlv(context,data): if context.account.leverage > context.mxlv: context.mxlv = context.account.leverage record(MxLv = context.mxlv)  It's not that I'd be that interested about your strategy. Rather I'm just highlighting rules as they state you should be hedged or be entirely in cash, and if you aren't hedged or in cash and only hold long positions don't expect to score high in the contest. Harlequin Sheep makes an important point when he writes: ..... one of the first lessons you will learn as a trader is that you are not entitled to anything. No one owes you a penny in this world. The market has eaten plenty of "geniuses" and will spank you silly if you do not approach with a well-earned humility. I have a friend named Andrea Unger. He is a very nice person. He is one of the most intelligent people in Europe. He is a trader. He is the only person to have ever won the Word Futures Trading Championship three times in a row. It is a year-long competition, live, with the person using their own money. You can find him on the Internet if you are interested to see a real trader, one of the best-of-the best. When asked in interviews what is the most important characteristic to be a successful trader, Andrea always says exactly the same thing: "Humility". He is a great inspiration to me and a pleasure to be with. I wish you a comparable level of success in your own trading, but there are other things more important than high returns. Like survival. Good luck!. Leo Williams is presenting an interesting trading strategy using the same tools and data as everyone else. That he limits what he is accepting to show is his right. It is how he can protect his intellectual property. After all, a program is just a program, a few thousand lines of code that does not care on which machine it is ran. That said, I have no doubt that what Leo has presented are snapshots of what is on his monitor and I accept that at face value. What those charts say is that it is possible to generate more alpha than just average. I see his strategy as chasing short-term momentum and catching some of it. The way he does it is his own. And putting it on the table can only say: you can do it too. Leo, congratulation. Keep posting as this evolves. I like it. Leo is undoubtedly providing something for many of us to think about... one way or another!! Guy comments: "Leo Williams is presenting an interesting trading strategy using the same tools and data as everyone else" [has available to them here at Quantopian is implied]. I agree with Guy's comment, although with one slight modification in that Leo is presenting his trading RESULTS but (as to be expected of course) not very much of his trading STRATEGY, other than the following snippets: " The program ...detected an FDA approval", " ...processes thousands of rss feeds and strips out what I've defined for it to detect". That is enough for everyone to get the idea. Beyond that, whether the program is voice activated, or talks or sings opera or whatever, well that's nice I suppose but not really relevant to the bottom line. Guy continues: "What those charts say is that it is possible to generate more alpha than just average. I see his strategy as chasing short-term momentum and catching some of it. The way he does it is his own. And putting it on the table can only say: you can do it too". Yes, I wholeheartedly agree with that and, whatever else one may think / feel / believe about this series of posts and its "interesting" originator, I for one now feel inspired to start thinking very seriously about the potential of alternative data! So, along with Guy, I also encourage you to keep posting Leo. Follow the bronze butterfly Daniel San. He knows the way to the 1%! Listen to Mr. Sheep and build a mobile home of very heavy, dense metal. Thanks Tony. I appreciate the support. I also see the case than can be made for Bronze Butterfly. I think it all boils down to risk appetite. However, I think there is something missing from the back testing that should factored in that is not. A while back I wrote an algorithm based on Benjamin Grahams fundamental formulas that did pretty well. I did this by calculating the intrinsic values of stocks that met Graham's criteria, buying those that were undervalued, and selling at the price target, or if the underlying fundamentals changed. In reading much of what Buffet Stated, he factors in INFLATION into to his investment strategy. He looks to make 10% on his investment, but factors in inflation at 5%. Let us further examine this equation. If we start with 10 million, and it just sits there, it's essentially worth 995k, after the first year. If you compound this over seven years, it is now worth$6,983,372, in terms of today's current buying power. You've essentially lost 30%. I think that Quantopian should factor inflation into their back testing results, because if you take the 1.5%, even with the low risk of Mr. Sheeps algo, you are losing 3.5% per year in buying power. When you compare than to a 59% return, inflation subtracted, with a higher Sharpe, and zero losses during market crashes, I think it's safe to say, my score should be 100! By all means, hedge away! And yes, you CAN win the Indy 500 on a rusty armored bicycle. Anything is possible.

Hi Leo,
Yep, sure, Buffet is living testimony to the fact that Graham's stuff works OK, at least when the market transitions to "weighing machine" mode from its more common manic "voting machine" mode, and one has the patience to actually wait for that, like Buffett & Munger do. Your point about inflation is of course correct and becomes important in any long-term venture. Yes, I agree that beating inflation is a better minimum-returns criterion than 0%. In your case however, your returns are SOOOOO far ahead of inflation that it shouldn't matter to you whether inflation-adjustment is used or not. Congratulations on that part. Enormous wealth will surely be yours .... as long as you don't blow your account out of the water along the way. Just watch out for dangerous rocks, sharks & drawdowns !!! :-) Cheers, best wishes.

How did the algo fair today?

Here are today's stats.

Returns: 11.04% Dollar P/L: $1,104,101.28 Sharpe: 11.67 Rusty Armored Bicycles: 0 And guys, I am a trader. I've been trading for almost three years now. I initially lost 12,000, which wasn't much, but I believed that with time I would learn to become a better trader, and financial freedom was what drew me to trading. I am now a profitable trader who leverages both fundamental and technical analysis. I do not consider myself an expert. However, the strategies I've developed are currently allowing me to beat the market. I've made almost 2,000 this week on 10K in IB. I do not believe that you can write good algorithms if you haven't had some experience as a trader. I also do not believe you can be reckless in your algorithms, but there are different ways to achieve the same goals. That being said, this platform has many shortfalls, as awesome as it is. We can't see spreads, like five cent tick stocks. We can't trade pre-market, or post-market, which is usually the genesis of big moves. I am going to continue to grow my account as a trader because I trade sensibly, not with reckless abandon. You have to have a system. You need to calculate your risks prior to making moves, and make moves that make sense. And NO the market is not your friend. Put a stop loss on a chart with everyone else and watch the Market Maker spike the price and stop you out. Use hot keys instead. And No, price does not move in accordance with supply and demand. It moves in the interest of the Market Makers who capitalize on the spread, and will accumulate orders at a price level for greater profit at a higher. That's why you need level II to gauge price direction. Some scenarios are also very predictable if you know what to look for. Huge buy orders at a price level, and major short selling volume results in a price explosion to the upside, because when short sellers cover, it results in a buy order. You can see if there are shares available to short in IB and you can see the volume at a particular price. It's just math folks. That's all it is. Remember, the Market is always right, not your ego. There is a saying in trading that I believe is very true. Pigs get fat. Hogs get slaughtered. Know when to hold em. Know when to fold em! How crazy L. I've been trading roughly three years now. Started with a retail account. Lost @$12,000, and then moved to paper trading. I was also drawn in because I saw a path out of poverty laid out before me as soon as I saw that first candlestick chart. Money, analytics, and mathematics have always been some of my favorite things. I've developed my own position sizing strategy for my manual active trading. It requires knowing support/resistance, account value, and uses a % risk model to calculate entry and exit points. Risk management is very important! I now work at a trade desk for over a year (In an operational capacity.. Nothing glamorous.), have gotten my 7, working on my 66, and am waiting for my NEW retail account to open. I'll be funding it shortly. I wish you luck man.

Leo, forget about "sick desperate losers". If anyone really is actually hacking your machine now, then its unlikely to be just some jealous script-kiddie. You have been very actively promoting yourself as a genius who can make BILLIONS!! Surely you don't imagine that you haven't already attracted the attention of some nasty international players, possibly including less-than-totally-friendly governments and criminal organizations. The sort of people that I personally do not even want to think about, much less talk about. I keep politely suggesting to you that you think carefully about the implications and possible consequences of your behavior and your actions. Best wishes to you, from Tony.

You're right Tony. How do I delete this thread?

It's clear now with beta of 42 for multiple days, this is simply another case of hidden margin.

@LW Could you paste this at the end of initialize() and report its last value?

def initialize(context):

...

context.mxlv = 0
for i in range(1, 391):
schedule_function(mxlv, date_rules.every_day(), time_rules.market_open(minutes=i))

def mxlv(context, data):
if context.account.leverage > context.mxlv:
context.mxlv = context.account.leverage
record(MxLv = context.mxlv)


In a June LW post, he was rightfully asking for help on runaway leverage. I provided this solution and the returns went from a peak of 43000% to 226%.

It is not easy to expose margin. One cannot simply do a once-per-day leverage record. For example, opening positions early, closing them near market close, then recording leverage at end of day (presuming none unfilled), leverage will always show zero, but that is not zero invested. (As in the backtest below where leverage shows 0. Returns by the way appear to be 92%, are only 10% on the amount invested with margin accounted for)

Recording cash once per day is the same problem.

It is easy to presume leverage is fine when it isn't.
The only way to know is to keep track of maximum leverage every minute every day. That's the mxlv code above, a better version of this.

A third trace in the main chart, margin, would avoid these things but I don't know how easy or difficult that would be.

320
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
''' https://www.quantopian.com/posts/submitted-a-billion-dollar-algo

An example of zero leverage in the chart yet maximum leverage over 8.

'''

def initialize(context):
schedule_function(sel, date_rules.every_day(), time_rules.market_close(minutes=10))

# Even tho this is mid-day, it is overridden by the one that comes later.
schedule_function(lv,  date_rules.every_day(), time_rules.market_open(minutes=199))

# Try commenting the next line to turn off end-of-day leverage record.
schedule_function(lv,  date_rules.every_day(), time_rules.market_close())

for i in range(1, 391):
break      # comment/remove to activate and chart what's really happening
schedule_function(pvr, date_rules.every_day(), time_rules.market_open(minutes=i))

context.mxlv = 0
for i in range(1, 391):
schedule_function(mxlv, date_rules.every_day(), time_rules.market_open(minutes=i))

def lv(context,data):
record(Lv = context.account.leverage)

def mxlv(context,data):
if context.account.leverage > context.mxlv:
context.mxlv = context.account.leverage
record(MxLv = context.mxlv)

order(sid(8554), 400)

def sel(context,data):
order_target(sid(8554), 0)

def pvr(context, data):
''' Custom chart and/or logging of profit_vs_risk returns and related information
https://www.quantopian.com/posts/pvr
'''
import time
from datetime import datetime
from pytz import timezone      # Python will only do once, makes this portable.
#   Move to top of algo for better efficiency.
c = context  # Brevity is the soul of wit -- Shakespeare [for readability]
if 'pvr' not in c:

# For real money, you can modify this to total cash input minus any withdrawals
manual_cash = c.portfolio.starting_cash
time_zone   = 'US/Pacific'   # Optionally change to your own time zone for wall clock time

c.pvr = {
'options': {
# # # # # # # # # #  Options  # # # # # # # # # #
'logging'         : 0,    # Info to logging window with some new maximums
'log_summary'     : 126,  # Summary every x days. 252/yr

'record_pvr'      : 1,    # Profit vs Risk returns (percentage)
'record_pvrp'     : 0,    # PvR (p)roportional neg cash vs portfolio value
'record_cash'     : 0,    # Cash available
'record_max_lvrg' : 1,    # Maximum leverage encountered
'record_max_risk' : 1,    # Highest risk overall
'record_shorting' : 0,    # Total value of any shorts
'record_max_shrt' : 0,    # Max value of shorting total
'record_cash_low' : 1,    # Any new lowest cash level
'record_q_return' : 0,    # Quantopian returns (percentage)
'record_pnl'      : 0,    # Profit-n-Loss
'record_risk'     : 0,    # Risked, max cash spent or shorts beyond longs+cash
'record_leverage' : 0,    # End of day leverage (context.account.leverage)
# All records are end-of-day or the last data sent to chart during any day.
# The way the chart operates, only the last value of the day will be seen.
# # # # # # # # #  End options  # # # # # # # # #
},
'pvr'        : 0,      # Profit vs Risk returns based on maximum spent
'cagr'       : 0,
'max_lvrg'   : 0,
'max_shrt'   : 0,
'max_risk'   : 0,
'days'       : 0.0,
'date_prv'   : '',
'date_end'   : get_environment('end').date(),
'cash_low'   : manual_cash,
'cash'       : manual_cash,
'start'      : manual_cash,
'tz'         : time_zone,
'begin'      : time.time(),  # For run time
'run_str'    : '{} to {}  \${}  {} {}'.format(get_environment('start').date(), get_environment('end').date(), int(manual_cash), datetime.now(timezone(time_zone)).strftime("%Y-%m-%d %H:%M"), time_zone)
}
if c.pvr['options']['record_pvrp']: c.pvr['options']['record_pvr'] = 0 # if pvrp is active, straight pvr is off
if get_environment('arena') not in ['backtest', 'live']: c.pvr['options']['log_summary'] = 1 # Every day when real money
log.info(c.pvr['run_str'])
p = c.pvr ; o = c.pvr['options'] ; pf = c.portfolio
pnl = pf.portfolio_value - p['start']
def _pvr(c):
p['cagr'] = ((pf.portfolio_value / p['start']) ** (1 / (p['days'] / 252.))) - 1
ptype = 'PvR' if o['record_pvr'] else 'PvRp'
log.info('{} {} %/day   cagr {}   Portfolio value {}   PnL {}'.format(ptype, '%.4f' % (p['pvr'] / p['days']), '%.3f' % p['cagr'], '%.0f' % pf.portfolio_value, '%.0f' % pnl))
log.info('  Profited {} on {} activated/transacted for PvR of {}%'.format('%.0f' % pnl, '%.0f' % p['max_risk'], '%.1f' % p['pvr']))
log.info('  QRet {} PvR {} CshLw {} MxLv {} MxRisk {} MxShrt {}'.format('%.2f' % (100 * pf.returns), '%.2f' % p['pvr'], '%.0f' % p['cash_low'], '%.2f' % p['max_lvrg'], '%.0f' % p['max_risk'], '%.0f' % p['max_shrt']))
def _minut():
dt = get_datetime().astimezone(timezone(p['tz']))
return str((dt.hour * 60) + dt.minute - 570).rjust(3)  # (-570 = 9:31a)
date = get_datetime().date()
if p['date_prv'] != date:
p['date_prv'] = date
p['days'] += 1.0
do_summary = 0
if o['log_summary'] and p['days'] % o['log_summary'] == 0 and _minut() == '100':
do_summary = 1              # Log summary every x days
if do_summary or date == p['date_end']:
p['cash'] = pf.cash
elif p['cash'] == pf.cash and not o['logging']: return  # for speed

shorts = sum([z.amount * z.last_sale_price for s, z in pf.positions.items() if z.amount < 0])
new_key_hi = 0                  # To trigger logging if on.
cash       = pf.cash
cash_dip   = int(max(0, p['start'] - cash))
risk       = int(max(cash_dip, -shorts))

if o['record_pvrp'] and cash < 0:   # Let negative cash ding less when portfolio is up.
cash_dip = int(max(0, cash_dip * p['start'] / pf.portfolio_value))
# Imagine: Start with 10, grows to 1000, goes negative to -10, should not be 200% risk.

if int(cash) < p['cash_low']:             # New cash low
new_key_hi = 1
p['cash_low'] = int(cash)             # Lowest cash level hit
if o['record_cash_low']: record(CashLow = p['cash_low'])

if c.account.leverage > p['max_lvrg']:
new_key_hi = 1
p['max_lvrg'] = c.account.leverage    # Maximum intraday leverage
if o['record_max_lvrg']: record(MxLv    = p['max_lvrg'])

if shorts < p['max_shrt']:
new_key_hi = 1
p['max_shrt'] = shorts                # Maximum shorts value
if o['record_max_shrt']: record(MxShrt  = p['max_shrt'])

if risk > p['max_risk']:
new_key_hi = 1
p['max_risk'] = risk                  # Highest risk overall
if o['record_max_risk']:  record(MxRisk = p['max_risk'])

# Profit_vs_Risk returns based on max amount actually invested, long or short
if p['max_risk'] != 0: # Avoid zero-divide
p['pvr'] = 100 * pnl / p['max_risk']
ptype = 'PvRp' if o['record_pvrp'] else 'PvR'
if o['record_pvr'] or o['record_pvrp']: record(**{ptype: p['pvr']})

if o['record_shorting']: record(Shorts = shorts)             # Shorts value as a positve
if o['record_leverage']: record(Lv     = c.account.leverage) # Leverage
if o['record_cash']    : record(Cash   = cash)               # Cash
if o['record_risk']    : record(Risk   = risk)  # Amount in play, maximum of shorts or cash used
if o['record_q_return']: record(QRet   = 100 * pf.returns)
if o['record_pnl']     : record(PnL    = pnl)                # Profit|Loss

if o['logging'] and new_key_hi:
log.info('{}{}{}{}{}{}{}{}{}{}{}{}'.format(_minut(),
' Lv '     + '%.1f' % c.account.leverage,
' MxLv '   + '%.2f' % p['max_lvrg'],
' QRet '   + '%.1f' % (100 * pf.returns),
' PvR '    + '%.1f' % p['pvr'],
' PnL '    + '%.0f' % pnl,
' Cash '   + '%.0f' % cash,
' CshLw '  + '%.0f' % p['cash_low'],
' Shrt '   + '%.0f' % shorts,
' MxShrt ' + '%.0f' % p['max_shrt'],
' Risk '   + '%.0f' % risk,
' MxRisk ' + '%.0f' % p['max_risk']
))
if do_summary: _pvr(c)
if get_datetime() == get_environment('end'):   # Summary at end of run
_pvr(c) ; elapsed = (time.time() - p['begin']) / 60  # minutes
log.info( '{}\nRuntime {} hr {} min'.format(p['run_str'], int(elapsed / 60), '%.1f' % (elapsed % 60)))


There was a runtime error.

Ah you're right, beta is 7.55 now, meanwhile think of what a pleasure it would be to prove me wrong by pasting that code in your algo.

Unfortunately, I cannot give you any additional insight. You will just have to go with your gut. I just back tested and validated that your assertions were emphatically false. With respect to beta as a point of argument, it simply means that I'm outperforming the market, even when it's doing well. 1.1 milllion on 10 million in three days will do that. Over on the right, you can see the back test returns, the stats you were referring to. The beta there is listed at:

BETA
How connected your algorithm is to swings in the value of SPY. Closer to zero is better.
0.1410

That is far in excess of what is required to win this contest, particularly when you couple that with a Sharpe, currently, in double digits in conjunction with the highest returns on the entire list. Yoda was indeed right. Listen to Yoda. He knows the way to the force.

Here is a snapshot of leverage Gary. Now, please, I do not want to hear anymore of this foolishness. Again, it will NEVER exceed one. I ensure that it never does.

Three words to live by:

OUT OF SAMPLE

Thanks Blue for your neat bit of code to discover hidden margin & runaway leverage. I will use it, even though I know I don't need to.

I'm just a dumb ol' injuneer who can barely even write pyfon, let alone even figure out how to do anything tricky in my algos.

Leo, don't worry about deleting this thread. People at Quantopian are not going to hurt you, but it might be wise for you to be discreet about what you send out to the whole world on YouTube.

Best wishes to all real traders from kindly old uncle Tony (who has been pottering away at this since before many of you were even born).

Oh, and by the way, trading for 3 years means that you have never actually experienced "adverse market conditions" yet, so beware!

You are entitled to your opinion, even in the face of the facts. Likewise, I am equally entitled to disregard it completely. If Quantopian's back testing can't simulate real trading as you say, then by what metric do we judge your algorithm, and what would be the point of this experiment. Something is unrealistic, because "you" say it is? That is the metric that we should judge ideas by that outperform yours? I suppose as long as we achieve meager hedged returns, the back testing engine works fine. How convenient for you that would be. Best of luck to you Mr. Sheep. Unfortunately, there are only wolves on wall street. And judging by your name, and your fervent denial of reality, you're incapable of thinking like one. Good luck with inflation. I suppose the hedge fund managers you referenced don't incorporate those statistics into their thinking.

Thanks again Tony. However, my algorithm outperforms the market even in adverse conditions. 207% between 2007 and 2009. I posted those images earlier. It should do fine in any market with an overall beta of 0.14.

www.titlelight.com/images/silencioporfavor.jpg

That was a screenshot of your own record line, not my code.

Again, it will NEVER exceed one. I ensure that it never does.

You've been around here less than a year, easy to miss certain things.

Run my MxLv code, post screenshot, done.

Hey Harlequin, where can you see the results of past contests?

Awesome. So I take it then you've received an allocation for your work? How did that work out? Or did they give you T-shirt?

Here at Quantopian we work very hard to maintain a polite, cordial, and welcoming community. We welcome strong opinions and healthy debate. However, in our view, too many online forums (financial and otherwise) turn into angry, impolite, and unproductive messes.

This thread has slid outside of our preferred tone, and outside of our acceptable tone.

I'm closing this thread. No further posts will be permitted here. Please let the tone close here, and do not take it to any other threads.

Thank you for your kind understanding. Help us keep Quantopian a friendly and welcoming community.

no such thing as impresx or quant or quantopian, ml is just a toolx, monex matersx not, nonerx