tag:blogger.com,1999:blog-261139923818144971.post134953894304075622..comments2024-03-27T07:58:49.946+00:00Comments on This Blog is Systematic: Can you eat geometric returns?Rob Carverhttp://www.blogger.com/profile/10175885372013572770noreply@blogger.comBlogger31125tag:blogger.com,1999:blog-261139923818144971.post-31119832046088675622018-12-07T17:12:11.009+00:002018-12-07T17:12:11.009+00:00I haven't sounds interesting, thanks.I haven't sounds interesting, thanks.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-61334081902846273542018-12-07T17:02:54.221+00:002018-12-07T17:02:54.221+00:00Are you familiar with Ole Peter's work here?
h...Are you familiar with Ole Peter's work here?<br />https://ergodicityeconomics.com<br />He talks about how the classical economist model of expectation is wrong.<br /><br />The basic intuition is that we aren't actually trying to maximize across all possible universes. Rather we are trying to maximize across time in the universe we actually live in.<br />Adamhttps://www.blogger.com/profile/06322829170182246410noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-81981023108703210382018-02-27T09:05:52.036+00:002018-02-27T09:05:52.036+00:00At the bottom of this web page is a 'contact m...At the bottom of this web page is a 'contact me boxRob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-15707331953655649802018-02-26T23:07:21.430+00:002018-02-26T23:07:21.430+00:00Hey how can I reach you?Hey how can I reach you?FWhttps://www.blogger.com/profile/12270617770183263350noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-49964343545234157722018-02-26T23:06:38.026+00:002018-02-26T23:06:38.026+00:00Hey, How can I contact you?Hey, How can I contact you?FWhttps://www.blogger.com/profile/12270617770183263350noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-86332337802409581172018-01-11T21:16:41.062+00:002018-01-11T21:16:41.062+00:00This contemporaneous paper provides a related pers...This contemporaneous paper provides a related perspective on geometric vs arithmetic mean returns and the connection to the Kelly Criterion: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2914076Max Bolingbrokehttps://www.blogger.com/profile/05003540528496327090noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-66493068548059010722017-10-22T06:10:25.250+01:002017-10-22T06:10:25.250+01:00No, Sharpe Ratio is intended for arithmetic return...No, Sharpe Ratio is intended for arithmetic returns which are required when you leverage/deleverage the tangency portfolio along the Capital Allocation Line. Average Arithmetic Returns - RFR / Volatility of Arithmetic does not vary as you increase/decrease leverage but it would certainly vary (defeating the purpose of the Sharpe Ratio) if you were to use LN returns. In other words, when you use sat 2x leverage, your LN returns are not 2x original LN returns.NGGhttps://www.blogger.com/profile/13617467616386044760noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-41480783858778377202017-10-01T16:31:09.721+01:002017-10-01T16:31:09.721+01:00The arithmetic mean of log returns is roughly equi...The arithmetic mean of log returns is roughly equivalent to the geometric mean of simple returns, but if you check out the formulas above you'll see that isn't quite true.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-22743165319774573132017-09-29T07:50:12.477+01:002017-09-29T07:50:12.477+01:00Hi Rob
Isn't this whole thing more about the c...Hi Rob<br />Isn't this whole thing more about the choice how you calculate returns in the first place? If you decide to go for simple returns, you would get geometric "compounding" for multi-period returns while using continuous (log) returns you would simply add them for multi-period returns hence arithmetic mean seems correct in the latter case. canicolahttps://www.blogger.com/profile/13060723918890635591noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-21782823106477731862017-06-20T21:13:35.265+01:002017-06-20T21:13:35.265+01:00Great Article, but you don't need to bring Ris...Great Article, but you don't need to bring Risk Psychology into it. In repeated betting, geometric mean will max return as shown by the Kelly Criteria regardless of risk attitudes. A Hhttps://www.blogger.com/profile/06916657901677009228noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-57309263199451185072017-02-20T09:34:47.291+00:002017-02-20T09:34:47.291+00:00Thank you Rob.
Sorry for the belated response, I...Thank you Rob. <br /><br />Sorry for the belated response, I thought I signed up for notifications but I guess I didn't. <br /><br />Anyway, I never hear of people using the geometric mean w/ the Sharpe Ratio (perhaps due to my ignorance), which is why I asked the question. <br /><br />Thanks again. Brianhttps://www.blogger.com/profile/00327457222316853934noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-86436356498662902122017-02-14T10:24:16.383+00:002017-02-14T10:24:16.383+00:00No you should use the geometric mean in the Sharpe...No you should use the geometric mean in the Sharpe Ratio, what you are doing is correct.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-81099479455311872472017-02-14T02:54:33.312+00:002017-02-14T02:54:33.312+00:00Hi Rob,
Shouldn’t the Sharpe Ratio use the geomet...Hi Rob,<br /><br />Shouldn’t the Sharpe Ratio use the geometric mean since it calculates off of percent averages? <br /><br />I use the geometric mean to measure my accounts avg. daily account growth since it is based off of daily percent averages. For instance, 4% growth represented by 1.04 and a 3% drawdown represented by 0.97, etc... Is this wrong? Should I be using the arithmetic mean?<br /><br />Please advise. Thank you.Brianhttps://www.blogger.com/profile/00327457222316853934noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-41373108127627441572017-02-11T11:35:42.635+00:002017-02-11T11:35:42.635+00:00I do occasionally get weird stuff from the data fe...I do occasionally get weird stuff from the data feed i.e. a price of 0. But that is easy to filter out. The general chatter on the web is that the data feed isn't as reliable as others, and if you're doing proper low latency trading you certainly can't use it.<br /><br />However for my purposes it's worked well enough.<br /><br />I'd like to thank you also as we did together find this bug!!!<br /><br />Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-60251220046476994102017-02-10T19:33:12.662+00:002017-02-10T19:33:12.662+00:00Yes, I understand. I'm just trying to get a sn...Yes, I understand. I'm just trying to get a snapshot from the market with this code, I did it succesfully for all other assets but I'm getting this error for ZS. Anyway, thanks for your help.MartinPhttps://www.blogger.com/profile/09901830354266450839noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-50481976131877332402017-02-10T19:22:33.696+00:002017-02-10T19:22:33.696+00:00Hmmm. Its very hard to debug this kind of code. I&...Hmmm. Its very hard to debug this kind of code. I'd suggest changing it so you don't terminate the loop until you have a bid and an ask at the same time, and you also wipe stale quotes out to ensure they're real and syncrhonised.<br /><br />To be honest: If you're going to actually use this to create an execution algo then you're probably going to need to do something a lot more complicated than this. Specifically you will need proper event driven code rather than pseudo event driven. <br /><br />At some point in the future there will be code to do this on this blog...Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-91711698654011310912017-02-10T18:53:45.286+00:002017-02-10T18:53:45.286+00:00The error is not coming from my modification, I ju...The error is not coming from my modification, I just tested it. So, I have no idea where this problem is coming from, maybe its an issue with IB datafeed.MartinPhttps://www.blogger.com/profile/09901830354266450839noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-51822206122921399962017-02-10T17:44:56.079+00:002017-02-10T17:44:56.079+00:00Its a modified version of your code. From github y...Its a modified version of your code. From github your code is:<br /> def get_IB_market_data(self, ibcontract, seconds=30, tickerid=MEANINGLESS_ID):<br /><br /><br />...<br /><br /> <br /> while not finished and not iserror:<br /> iserror=self.cb.flag_iserror<br /> if (time.time() - start_time) > seconds:<br /> finished=True<br /> pass<br /> self.tws.cancelMktData(tickerid)<br /> <br /> marketdata=self.cb.data_tickdata[tickerid]<br /><br />...<br /><br /><br />But I changed it to be similar to an old version where the conditional if didnt just waited an amount of seconds but also looked if any value was captured by data_tickdata[tickerid][0].MartinPhttps://www.blogger.com/profile/09901830354266450839noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-51678938808930871922017-02-10T17:13:26.263+00:002017-02-10T17:13:26.263+00:00Sorry I don't recognise the code you are showi...Sorry I don't recognise the code you are showing... is it from https://github.com/robcarver17/ibswigsystematicexamples/blob/master/sysIB/wrapper_v3.py ? If not I can't help you.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-62765997273068423962017-02-10T16:20:57.572+00:002017-02-10T16:20:57.572+00:00Now when the 1050 quote appears, it appears always...Now when the 1050 quote appears, it appears always to both the bid and ask at the same time. <br /><br />I have changed get_IB_market_data including the line isinstance(self.cb.data_tickdata[tickerid][0], int) here:<br /> <br /> while not finished and not iserror:<br /> iserror=self.cb.flag_iserror<br /> if isinstance(self.cb.data_tickdata[tickerid][0], int) or (time.time() - start_time) > seconds:<br /> finished=True<br /> pass<br /> self.tws.cancelMktData(tickerid)<br /><br />Its similar to your previous version of this function. Is this the reason why this problem is happening?MartinPhttps://www.blogger.com/profile/09901830354266450839noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-71297375048303799972017-02-10T15:47:04.038+00:002017-02-10T15:47:04.038+00:00I just found a small bug in the code (wrapperv3.py...I just found a small bug in the code (wrapperv3.py). Try pulling from github and seeing if the issue goes away.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-82003758877153378112017-02-10T14:51:10.190+00:002017-02-10T14:51:10.190+00:00Even though your answer makes perfect sense, I gue...Even though your answer makes perfect sense, I guess it's not what I'm getting here this time. I think there is something wrong with the function output because when inside of a loop of get_IB_market_data, it seems that sometime the function freezes and shows a standardized bid-ask price. Below is the loop output from this function.<br />def getprices(contract,tradesize):<br /> sideprice=float('nan')<br /> offsideprice=float('nan')<br /> while math.isnan(sideprice) or math.isnan(offsideprice):<br /> ans1=client.get_IB_market_data(ibcontract)<br /> if tradesize>0:<br /> sideprice=ans1[3]<br /> offsideprice=ans1[2]<br /> elif tradesize<0:<br /> sideprice=ans1[2]<br /> offsideprice=ans1[3]<br /> return sideprice,offsideprice<br /><br />...<br />sideprice : offsideprice<br />1062.0 1061.75<br />Ordem LMT: 1061.75<br />sideprice : offsideprice<br />1062.0 1061.75<br />Ordem LMT: 1061.75<br />sideprice : offsideprice<br />1050.0 1061.75<br />Ordem LMT: 1061.75<br />sideprice : offsideprice<br />1062.0 1061.75<br />Ordem LMT: 1061.75<br />sideprice : offsideprice<br />1062.0 1061.75<br />Ordem LMT: 1061.75<br />...<br />If you want I can email you with more details.<br />MartinMartinPhttps://www.blogger.com/profile/09901830354266450839noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-15242586932787310592017-02-10T13:32:59.143+00:002017-02-10T13:32:59.143+00:00An example might be that the order book is at 1051...An example might be that the order book is at 1051.5 - 1051.75 with 10 lots on each side. Someone hits the bid at 1051.5 with a 15 lot order. The first 10 lots are filled and the 1051.5 quote is no longer the best bid. The remaining 5 lots offered at 1051.5 become the best offer.<br /><br />The true market is now an offer at 1051.5 for 5 lots with nothing on the bid. But the price capturing algo still has a memory of the bid at 1051.5. So it displays 1051.5 - 1051.5<br /><br />The last bid quote doesn't get 'deleted'; it can only be superseded once a new best bid appears in the market. If there wasn't a bid already in the order book at say 1051.25 then there is no new best bid. Sometimes the IB API will then send a 'NA' bid price but sometimes it takes a while for this to happen. <br /><br />It's more likely in thinly traded markets without much depth since quotes can remain stale for longer.<br /><br />The way to deal with this is to remove prices which are stale, say more than a few seconds old, and replace them yourself with NAs.<br /><br />Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-67710976829870365562017-02-10T12:36:19.583+00:002017-02-10T12:36:19.583+00:00I'm having this problem only for ZS. Can you e...I'm having this problem only for ZS. Can you explain me why does it happen? Im trying to run a loop the same way you did here: http://qoppac.blogspot.com.br/2014/10/the-worlds-simplest-execution-algorithim.html<br />MartinPhttps://www.blogger.com/profile/09901830354266450839noreply@blogger.comtag:blogger.com,1999:blog-261139923818144971.post-4448488080188280862017-02-10T06:22:21.407+00:002017-02-10T06:22:21.407+00:00If you take the view that you can't predict ri...If you take the view that you can't predict risk adjusted returns then if anything someone withdrawing money should go for a safer portfolio (80/20 rather than 100/0).<br /><br />Its dangerous to start having subjective "poor bond yields" type thoughts. You should eithier use a systematic model to forecast returns or not bother.<br /><br />Actually at an asset class level relative yield is a very poor measure of performance compared to say 12 month momentum. Momentum is still positive for bonds, albiet not as strong as in equities.<br /><br />All this might justify a reduction from a strategic 80:20 split to a tactical 85:15 split, but no bigger change than that.<br /><br />... or you could just wait for the next book which will discuss this in much more detail.Rob Carverhttps://www.blogger.com/profile/10175885372013572770noreply@blogger.com