PDF Python for finance: mastering data-driven finance 2nd edition download

Page 1


Python for Finance: Mastering Data-Driven Finance 2nd Edition

Visit to download the full and correct content document: https://ebookmass.com/product/python-for-finance-mastering-data-driven-finance-2nd -edition/

More products digital (pdf, epub, mobi) instant download maybe you interests ...

Python for Finance: A Crash Course Modern Guide: Learn Python Fast Bisette

https://ebookmass.com/product/python-for-finance-a-crash-coursemodern-guide-learn-python-fast-bisette/

Data-Driven SEO with Python: Solve SEO Challenges with Data Science Using Python 1st Edition Andreas Voniatis

https://ebookmass.com/product/data-driven-seo-with-python-solveseo-challenges-with-data-science-using-python-1st-editionandreas-voniatis/

Swiss Finance: Banking, Finance, and Digitalization 2nd Edition Henri B. Meier

https://ebookmass.com/product/swiss-finance-banking-finance-anddigitalization-2nd-edition-henri-b-meier/

Python Fundamentals for Finance: A survey of Algorithmic Options trading with Python Van Der Post

https://ebookmass.com/product/python-fundamentals-for-finance-asurvey-of-algorithmic-options-trading-with-python-van-der-post/

Behavioral Finance and Your Portfolio: A Navigation Guide for Building Wealth (Wiley Finance), 2nd Edition

https://ebookmass.com/product/behavioral-finance-and-yourportfolio-a-navigation-guide-for-building-wealth-wileyfinance-2nd-edition-michael-m-pompian/

Data Universe: Organizational Insights with Python: Embracing Data Driven Decision Making Van Der Post

https://ebookmass.com/product/data-universe-organizationalinsights-with-python-embracing-data-driven-decision-making-vander-post/

Hedge Funds For Dummies (For Dummies-Business & Personal Finance) 2nd Edition Logue

https://ebookmass.com/product/hedge-funds-for-dummies-fordummies-business-personal-finance-2nd-edition-logue/

Principles of Project Finance 2nd Edition, (Ebook PDF)

https://ebookmass.com/product/principles-of-project-finance-2ndedition-ebook-pdf/

Finance for Real Estate Development

https://ebookmass.com/product/finance-for-real-estatedevelopment/

edition,theapproachisapracticalone,inthatimplementationand illustrationcomebeforetheoreticaldetailsandIgenerallyfocusonthebig pictureratherthanthemostarcaneparameterizationoptionsofacertain class,method,orfunction.

Havingdescribedthebasicapproachforthesecondedition,itisworth emphasizingthatthisbookisneitheranintroductiontoPython programmingnortofinanceingeneral.Avastnumberofexcellent resourcesareavailableforboth.Thisbookislocatedattheintersectionof thesetwoexcitingfields,andassumesthatthereaderhassomebackground inprogramming(notnecessarilyPython)aswellasinfinance.Suchreaders learnhowtoapplyPythonanditsecosystemtothefinancialdomain.

TheJupyterNotebooksandcodesaccompanyingthisbookcanbeaccessed andexecutedviaourQuantPlatform.Youcansignupforfreeat http://py4fi.pqp.io.

Mycompany(ThePythonQuants)andmyselfprovidemanymore resourcestomasterPythonforfinancialdatascience,artificialintelligence, algorithmictrading,andcomputationalfinance.Youcanstartbyvisitingthe followingsites:

Ourcompanywebsite

Myprivatewebsite

OurPythonbookswebsite

Ouronlinetrainingwebsite

TheCertificateProgramwebsite

Fromalltheofferingsthatwehavecreatedoverthelastfewyears,Iam mostproudofour Certificate Program in Python for Algorithmic Trading. Itprovidesover150hoursofliveandrecordedinstruction,over1,200 pagesofdocumentation,over5,000linesofPythoncode,andover50 JupyterNotebooks.Theprogramisofferedmultipletimesperyearandwe updateandimproveitwitheverycohort.Theonlineprogramisthefirstof

itskind,inthatsuccessfuldelegatesobtainanofficialuniversitycertificate incooperationwithhtwsaarUniversityofAppliedSciences.

Inaddition,IrecentlystartedTheAIMachine,anewprojectandcompany tostandardizethedeploymentofautomated,algorithmictradingstrategies. Withthisproject,wewanttoimplementinasystematicandscalable fashionwhatwehavebeenteachingovertheyearsinthefield,inorderto capitalizeonthemanyopportunitiesinthealgorithmictradingfield.Thanks toPython—anddata-drivenandAI-firstfinance—thisprojectispossible thesedaysevenforasmallerteamlikeours.

Iclosedtheprefaceforthefirsteditionwiththefollowingwords:

IamreallyexcitedthatPythonhasestablisheditselfasanimportant technologyinthefinancialindustry.Iamalsosurethatitwillplayan evenmoreimportantrolethereinthefuture,infieldslikederivativesand riskanalyticsorhighperformancecomputing.Myhopeisthatthisbook willhelpprofessionals,researchers,andstudentsalikemakethemostof Pythonwhenfacingthechallengesofthisfascinatingfield.

WhenIwrotetheselinesin2014,Icouldn’thavepredictedhowimportant Pythonwouldbecomeinfinance.In2018,Iamevenhappierthatmy expectationsandhopeshavebeensogreatlysurpassed.Maybethefirst editionofthebookplayedasmallpartinthis.Inanycase,abigthankyou isinordertoalltherelentlessopensourcedevelopersoutthere,without whomthesuccessstoryofPythoncouldn’thavebeenwritten.

ConventionsUsedinThisBook

Thefollowingtypographicalconventionsareusedinthisbook:

Italic

Indicatesnewterms,URLs,andemailaddresses.

Constant width

Usedforprogramlistings,aswellaswithinparagraphstoreferto softwarepackages,programminglanguages,fileextensions,filenames, programelementssuchasvariableorfunctionnames,databases,data types,environmentvariables,statements,andkeywords.

Constant width italic

Showstextthatshouldbereplacedwithuser-suppliedvaluesorby valuesdeterminedbycontext.

TIP

Thiselementsignifiesatiporsuggestion.

Thiselementsignifiesageneralnote.

NOTE

WARNING

Thiselementindicatesawarningorcaution.

UsingCodeExamples

Supplementalmaterial(inparticular,JupyterNotebooksandPython scripts/modules)isavailableforusageanddownloadat http://py4fi.pqp.io.

Thisbookisheretohelpyougetyourjobdone.Ingeneral,ifexamplecode isofferedwiththisbook,youmayuseitinyourprogramsand documentation.Youdonotneedtocontactusforpermissionunlessyou’re reproducingasignificantportionofthecode.Forexample,writinga programthatusesseveralchunksofcodefromthisbookdoesnotrequire permission.SellingordistributingaCD-ROMofexamplesfromO’Reilly booksdoesrequirepermission.Answeringaquestionbycitingthisbook andquotingexamplecodedoesnotrequirepermission.Incorporatinga significantamountofexamplecodefromthisbookintoyourproduct’s documentationdoesrequirepermission. Weappreciate,butdonotrequire,attribution.Anattributionusually includesthetitle,author,publisher,andISBN.Forexample:“Python for Finance,2ndEdition,byYvesHilpisch(O’Reilly).Copyright2019Yves Hilpisch,978-1-492-02433-0.”

Ifyoufeelyouruseofcodeexamplesfallsoutsidefairuseorthe permissiongivenabove,feelfreetocontactusat permissions@oreilly.com.

O’ReillySafari

NOTE

Safari (formerlySafariBooksOnline)isamembership-basedtrainingand referenceplatformforenterprise,government,educators,andindividuals.

Membershaveaccesstothousandsofbooks,trainingvideos,Learning Paths,interactivetutorials,andcuratedplaylistsfromover250publishers, includingO’ReillyMedia,HarvardBusinessReview,PrenticeHall Professional,Addison-WesleyProfessional,MicrosoftPress,Sams,Que, PeachpitPress,Adobe,FocalPress,CiscoPress,JohnWiley&Sons, Syngress,MorganKaufmann,IBMRedbooks,Packt,AdobePress,FT Press,Apress,Manning,NewRiders,McGraw-Hill,Jones&Bartlett,and CourseTechnology,amongothers.

Formoreinformation,pleasevisit http://oreilly.com/safari.

HowtoContactUs

Pleaseaddresscommentsandquestionsconcerningthisbooktothe publisher:

O’ReillyMedia,Inc.

1005GravensteinHighwayNorth

Sebastopol,CA95472

800-998-9938(intheUnitedStatesorCanada)

707-829-0515(internationalorlocal)

707-829-0104(fax)

Wehaveawebpageforthisbook,wherewelisterrata,examples,andany additionalinformation.Youcanaccessthispageat http://bit.ly/pythonfinance-2e.

Tocommentorasktechnicalquestionsaboutthisbook,sendemailto bookquestions@oreilly.com.

Formoreinformationaboutourbooks,courses,conferences,andnews,see ourwebsiteat http://www.oreilly.com.

FindusonFacebook: http://facebook.com/oreilly

FollowusonTwitter: http://twitter.com/oreillymedia

WatchusonYouTube: http://www.youtube.com/oreillymedia

Acknowledgments

Iwanttothankallthosewhohelpedtomakethisbookareality—in particular,theteamatO’Reilly,whoreallyimprovedmymanuscriptin manyways.Iwouldliketothankthetechreviewers,HughBrownandJake VanderPlas.Thebookbenefitedfromtheirvaluablefeedbackandtheir manysuggestions.Anyremainingerrors,ofcourse,aremine.

MichaelSchwed,withwhomIhavebeenworkingcloselyformorethanten years,deservesaspecialthankyou.Overtheyears,Ihavebenefitedin innumerablewaysfromhiswork,support,andPythonknow-how.

IalsowanttothankJasonRamchandaniandJorgeSantosofRefinitiv (formerlyThomsonReuters)fortheircontinuedsupportnotonlyofmy workbutalsooftheopensourcecommunityingeneral.

Aswiththefirstedition,thesecondeditionofthisbookhastremendously benefitedfromthedozensof“Pythonforfinance”talksIhavegivenover theyears,aswellasthehundredsofhoursof“Pythonforfinance” trainings.Inmanycasesthefeedbackfromparticipantshelpedtoimprove mytrainingmaterials,whichoftenendedupaschaptersorsectionsinthis book.

Writingthefirsteditiontookmeaboutayear.Overall,writingand upgradingthesecondeditionalsotookaboutayear,whichwasquiteabit longerthanIexpected.Thisismainlybecausethetopicitselfkeepsme verybusytravel-andbusiness-wise,whichIamverygratefulfor.

Writingbooksrequiresmanyhoursinsolitudeandsuchhourscannotbe spentwiththefamily.Therefore,thankyoutoSandra,Lilli,Henry,Adolf, Petra,andHeinzforallyourunderstandingandsupport—notonlywith regardtowritingthisbook.

Idedicatethesecondeditionofthisbook,asthefirstone,tomylovely, strong,andcompassionatewifeSandra.Shehasgivennewmeaningover theyearstowhatfamilyisreallyabout.Thankyou.

Yves Saarland, November 2018

PartI.PythonandFinance

ThispartintroducesPythonforfinance.Itconsistsoftwochapters:

Chapter1brieflydiscussesPythoningeneralandarguesinsomedetail whyPythoniswellsuitedtoaddressingthetechnologicalchallengesin thefinancialindustryaswellasinfinancialdataanalytics.

Chapter2isaboutPythoninfrastructure;itprovidesaconcise overviewofimportantaspectsofmanagingaPythonenvironmentto getyoustartedwithinteractivefinancialanalyticsandfinancial applicationdevelopmentinPython.

Chapter1.WhyPythonfor Finance

Banksareessentiallytechnologyfirms.

ThePythonProgrammingLanguage

Pythonisahigh-level,multipurposeprogramminglanguagethatisusedin awiderangeofdomainsandtechnicalfields.Onthe Pythonwebsiteyou findthefollowingexecutivesummary:

Pythonisaninterpreted,object-oriented,high-levelprogramming languagewithdynamicsemantics.Itshigh-levelbuiltindatastructures, combinedwithdynamictypinganddynamicbinding,makeitvery attractiveforRapidApplicationDevelopment,aswellasforuseasa scriptingorgluelanguagetoconnectexistingcomponentstogether. Python’ssimple,easytolearnsyntaxemphasizesreadabilityand thereforereducesthecostofprogrammaintenance.Pythonsupports modulesandpackages,whichencouragesprogrammodularityandcode reuse.ThePythoninterpreterandtheextensivestandardlibraryare availableinsourceorbinaryformwithoutchargeforallmajorplatforms, andcanbefreelydistributed.

Thisprettywelldescribes why Pythonhasevolvedintooneofthemajor programminglanguagestoday.Nowadays,Pythonisusedbythebeginner programmeraswellasbythehighlyskilledexpertdeveloper,atschools,in universities,atwebcompanies,inlargecorporationsandfinancial institutions,aswellasinanyscientificfield.

Amongotherfeatures,Pythonis:

Open source

Pythonandthemajorityofsupportinglibrariesandtoolsavailableare opensourceandgenerallycomewithquiteflexibleandopenlicenses.

Interpreted

ThereferenceCPythonimplementationisaninterpreterofthe languagethattranslatesPythoncodeatruntimetoexecutablebyte code.

Multiparadigm

Pythonsupportsdifferentprogrammingandimplementation paradigms,suchasobjectorientationandimperative,functional,or proceduralprogramming.

Multipurpose

Pythoncanbeusedforrapid,interactivecodedevelopmentaswellas forbuildinglargeapplications;itcanbeusedforlow-levelsystems operationsaswellasforhigh-levelanalyticstasks.

Cross-platform

Pythonisavailableforthemostimportantoperatingsystems,suchas Windows,Linux,andmacOS.Itisusedtobuilddesktopaswellas webapplications,anditcanbeusedonthelargestclustersandmost powerfulserversaswellasonsuchsmalldevicesasthe RaspberryPi.

Dynamically typed

TypesinPythonareingeneralinferredatruntimeandnotstatically declaredasinmostcompiledlanguages.

Indentation aware

Incontrasttothemajorityofotherprogramminglanguages,Python usesindentationformarkingcodeblocksinsteadofparentheses, brackets,orsemicolons.

Garbage collecting

Pythonhasautomatedgarbagecollection,avoidingtheneedforthe programmertomanagememory.

WhenitcomestoPythonsyntaxandwhatPythonisallabout,Python

EnhancementProposal20—i.e.,theso-called“ZenofPython”— providesthemajorguidelines.Itcanbeaccessedfromeveryinteractive shellwiththecommand import this:

In [1]: import this

The Zen of Python, by Tim Peters

Beautiful is better than ugly.

Explicit is better than implicit. Simple is better than complex. Complex is better than complicated.

Flat is better than nested. Sparse is better than dense. Readability counts.

Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced.

In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never.

Although never is often better than *right* now.

If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea.

Namespaces are one honking great idea -- let's do more of those!

ABriefHistoryofPython

AlthoughPythonmightstillhavetheappealofsomething new tosome people,ithasbeenaroundforquitealongtime.Infact,developmentefforts beganinthe1980sbyGuidovanRossumfromtheNetherlands.Heisstill activeinPythondevelopmentandhasbeenawardedthetitleof Benevolent Dictator for Life bythePythoncommunity.InJuly2018,vanRossum steppeddownfromthispositionafterdecadesofbeinganactivedriverof thePythoncoredevelopmentefforts.Thefollowingcanbeconsidered milestonesinthedevelopmentofPython:

Python0.9.0releasedin1991(firstrelease)

Python1.0releasedin1994

Python2.0releasedin2000

Python2.6releasedin2008

Python3.0releasedin2008

Python3.1releasedin2009

Python2.7releasedin2010

Python3.2releasedin2011

Python3.3releasedin2012

Python3.4releasedin2014

Python3.5releasedin2015

Python3.6releasedin2016

Python3.7releasedinJune2018

Itisremarkable,andsometimesconfusingtoPythonnewcomers,thatthere aretwomajorversionsavailable,stillbeingdevelopedand,more importantly,inparallelusesince2008.Asofthiswriting,thiswillprobably keeponforalittlewhilesincetonsofcodeavailableandinproductionis stillPython2.6/2.7.Whilethefirsteditionofthisbookwasbasedon Python2.7,thissecondeditionusesPython3.7throughout.

ThePythonEcosystem

AmajorfeatureofPythonasanecosystem,comparedtojustbeinga programminglanguage,istheavailabilityofalargenumberofpackages andtools.Thesepackagesandtoolsgenerallyhavetobe imported when needed(e.g.,aplottinglibrary)orhavetobestartedasaseparatesystem process(e.g.,aPythoninteractivedevelopmentenvironment).Importing meansmakingapackageavailabletothecurrentnamespaceandthecurrent Pythoninterpreterprocess.

Pythonitselfalreadycomeswithalargesetofpackagesandmodulesthat enhancethebasicinterpreterindifferentdirections,knownasthe Python Standard Library.Forexample,basicmathematicalcalculationscanbe donewithoutanyimporting,whilemorespecializedmathematicalfunctions needtobeimportedthroughthe math module:

In [2]: 100 * 2.5 + 50

Out[2]: 300.0

In [3]: log(1)

NameError

Traceback (most recent call last)

<ipython-input-3-74f22a2fd43b> in <module> ----> 1 log(1)

NameError: name 'log' is not defined

In [4]: import math

In [5]: math.log(1)

Out[5]: 0.0

Withoutfurtherimports,anerrorisraised.

Afterimportingthe math module,thecalculationcanbeexecuted.

While math isastandardPythonmoduleavailablewithanyPython installation,therearemanymorepackagesthatcanbeinstalledoptionally andthatcanbeusedintheverysamefashionasthestandardmodules.Such

packagesareavailablefromdifferent(web)sources.However,itis generallyadvisabletouseaPythonpackagemanagerthatmakessurethat alllibrariesareconsistentwitheachother(see Chapter2formoreonthis topic).

ThecodeexamplespresentedsofaruseinteractivePythonenvironments: IPythonandJupyter,respectively.Theseareprobablythemostwidelyused interactivePythonenvironmentsatthetimeofthiswriting.Although IPythonstartedoutasjustanenhancedinteractivePythonshell,ittodayhas manyfeaturestypicallyfoundinintegrateddevelopmentenvironments (IDEs),suchassupportforprofilinganddebugging.Thosefeaturesmissing inIPythonaretypicallyprovidedbyadvancedtext/codeeditors,likeVim, whichcanalsobeintegratedwithIPython.Therefore,itisnotunusualto combineIPythonwithone’stext/codeeditorofchoicetoformthebasic toolchainforaPythondevelopmentprocess.

IPythonenhancesthestandardinteractiveshellinmanyways.Amongother things,itprovidesimprovedcommand-linehistoryfunctionsandallowsfor easyobjectinspection.Forinstance,thehelptext(docstring)fora functionisprintedbyjustaddinga ? beforeorafterthefunctionname (adding ?? willprovideevenmoreinformation).

IPythonoriginallycameintwopopularversions:a shell versionanda browser-based version(the Notebook).TheNotebookvariantprovedso usefulandpopularthatitevolvedintoanindependent,language-agnostic projectnowcalledJupyter.Giventhisbackground,itisnosurprisethat JupyterNotebookinheritsmostofthebeneficialfeaturesofIPython—and offersmuchmore,forexamplewhenitcomestovisualization.

RefertoVanderPlas(2016,Chapter1)formoredetailsonusingIPython.

ThePythonUserSpectrum

Pythondoesnotonlyappealtoprofessionalsoftwaredevelopers;itisalso ofuseforthecasualdeveloperaswellasfordomainexpertsandscientific developers.

Professional software developers findinPythonalltheymightrequireto efficientlybuildlargeapplications.Almostallprogrammingparadigmsare supported;therearepowerfuldevelopmenttoolsavailable;andanytask can,inprinciple,beaddressedwithPython.Thesetypesofuserstypically buildtheirownframeworksandclasses,alsoworkonthefundamental Pythonandscientificstack,andstrivetomakethemostoftheecosystem. Scientific developers or domain experts aregenerallyheavyusersofcertain packagesandframeworks,havebuilttheirownapplicationsthatthey enhanceandoptimizeovertime,andtailortheecosystemtotheirspecific needs.Thesegroupsofusersalsogenerallyengageinlongerinteractive sessions,rapidlyprototypingnewcodeaswellasexploringandvisualizing theirresearchand/ordomaindatasets.

Casual programmers liketousePythongenerallyforspecificproblems theyknowthatPythonhasitsstrengthsin.Forexample,visitingthegallery pageof matplotlib,copyingacertainpieceofvisualizationcodeprovided there,andadjustingthecodetotheirspecificneedsmightbeabeneficial usecaseformembersofthisgroup.

ThereisalsoanotherimportantgroupofPythonusers: beginner programmers,i.e.,thosethatarejuststartingtoprogram.Nowadays, Pythonhasbecomeaverypopularlanguageatuniversities,colleges,and evenschoolstointroducestudentstoprogramming.1 Amajorreasonfor thisisthatitsbasicsyntaxiseasytolearnandeasytounderstand,evenfor thenon-developer.Inaddition,itishelpfulthatPythonsupportsalmostall programmingstyles.2

TheScientificStack

Thereisacertainsetofpackagesthatiscollectivelylabeledthe scientific stack.Thisstackcomprises,amongothers,thefollowingpackages:

NumPy

NumPy providesamultidimensionalarrayobjecttostorehomogeneous orheterogeneousdata;italsoprovidesoptimizedfunctions/methodsto operateonthisarrayobject.

SciPy

SciPy isacollectionofsubpackagesandfunctionsimplementing importantstandardfunctionalityoftenneededinscienceorfinance;for example,onefindsfunctionsforcubicsplinesinterpolationaswellas fornumericalintegration.

matplotlib

ThisisthemostpopularplottingandvisualizationpackageforPython, providingboth2Dand3Dvisualizationcapabilities. pandas

pandas buildson NumPy andprovidesricherclassesforthe managementandanalysisoftimeseriesandtabulardata;itistightly integratedwith matplotlib forplottingand PyTables fordatastorage andretrieval.

scikit-learn

scikit-learn isapopularmachinelearning(ML)packagethat providesaunifiedapplicationprogramminginterface(API)formany differentMLalgorithms,suchasforestimation,classification,or clustering.

PyTables

PyTables isapopularwrapperforthe HDF5 datastoragepackage;itis apackagetoimplementoptimized,disk-basedI/Ooperationsbasedon ahierarchicaldatabase/fileformat.

Dependingonthespecificdomainorproblem,thisstackisenlargedby additionalpackages,whichmoreoftenthannothaveincommonthatthey buildontopofoneormoreofthesefundamentalpackages.However,the least common denominator or basic building blocks ingeneralarethe NumPy ndarray class(seeChapter4)andthe pandasDataFrame class(see Chapter5).

TakingPythonasaprogramminglanguagealone,thereareanumberof otherlanguagesavailablethatcanprobablykeepupwithitssyntaxand elegance.Forexample,Rubyisapopularlanguageoftencomparedto Python.Thelanguage’swebsitedescribesRubyas:

Adynamic,opensourceprogramminglanguagewithafocuson simplicityandproductivity.Ithasanelegantsyntaxthatisnaturaltoread andeasytowrite.

ThemajorityofpeopleusingPythonwouldprobablyalsoagreewiththe exactsamestatementbeingmadeaboutPythonitself.However,what distinguishesPythonformanyusersfromequallyappealinglanguageslike Rubyistheavailabilityofthescientificstack.ThismakesPythonnotonlya goodandelegantlanguagetouse,butalsoonethatiscapableofreplacing domain-specificlanguagesandtoolsetslikeMatlaborR.Italsoprovides bydefaultanythingthatyouwouldexpect,say,asaseasonedweb developerorsystemsadministrator.Inaddition,Pythonisgoodat interfacingwithdomain-specificlanguagessuchasR,sothatthedecision usuallyisnotabout either Python or something else —itisratherabout whichlanguageshouldbethemajorone.

TechnologyinFinance

Withthese“roughideas”ofwhatPythonisallabout,itmakessensetostep backabitandtobrieflycontemplatetheroleoftechnologyinfinance.This willputoneinapositiontobetterjudgetherolePythonalreadyplaysand, evenmoreimportantly,willprobablyplayinthefinancialindustryofthe future.

Inasense,technologyperseis nothing special tofinancialinstitutions(as compared,forinstance,tobiotechnologycompanies)ortothefinance function(ascomparedtoothercorporatefunctions,likelogistics). However,inrecentyears,spurredbyinnovationandalsoregulation,banks andotherfinancialinstitutionslikehedgefundshaveevolvedmoreand moreintotechnologycompaniesinsteadofbeing just financial intermediaries.Technologyhasbecomeamajorassetforalmostany financialinstitutionaroundtheglobe,havingthepotentialtoleadto competitiveadvantagesaswellasdisadvantages.Somebackground informationcanshedlightonthereasonsforthisdevelopment.

TechnologySpending

Banksandfinancialinstitutionstogetherformtheindustrythatspendsthe mostontechnologyonanannualbasis.Thefollowingstatementtherefore showsnotonlythattechnologyisimportantforthefinancialindustry,but thatthefinancialindustryisalsoreallyimportanttothetechnologysector:

FRAMINGHAM,Mass.,June14,2018–Worldwidespendingon informationtechnology(IT)byfinancialservicesfirmswillbenearly $500billionin2021,growingfrom$440billionin2018,accordingto newdatafromaseriesofFinancialServicesITSpendingGuidesfrom InternationalDataCorporation(IDC).

IDC

Inparticular,banksandotherfinancialinstitutionsareengaginginaraceto maketheirbusinessandoperatingmodelsdigital:

Bankspendingonnewtechnologieswaspredictedtoamountto19.9 billionU.S.dollarsin2017inNorthAmerica. Thebanksdevelopcurrentsystemsandworkonnewtechnological solutionsinordertoincreasetheircompetitivenessontheglobalmarket andtoattractclientsinterestedinnewonlineandmobiletechnologies.It isabigopportunityforglobalfintechcompanieswhichprovidenew ideasandsoftwaresolutionsforthebankingindustry.

Statista

Largemultinationalbankstodaygenerallyemploythousandsofdevelopers tomaintainexistingsystemsandbuildnewones.Largeinvestmentbanks withheavytechnologicalrequirementsoftenhavetechnologybudgetsof severalbillionUSDperyear.

TechnologyasEnabler

Thetechnologicaldevelopmenthasalsocontributedtoinnovationsand efficiencyimprovementsinthefinancialsector.Typically,projectsinthis arearunundertheumbrellaof digitalization.

Thefinancialservicesindustryhasseendrastictechnology-ledchanges overthepastfewyears.ManyexecutiveslooktotheirITdepartmentsto improveefficiencyandfacilitategame-changinginnovation—while somehowalsoloweringcostsandcontinuingtosupportlegacysystems. Meanwhile,FinTechstart-upsareencroachinguponestablishedmarkets, leadingwithcustomer-friendlysolutionsdevelopedfromthegroundup andunencumberedbylegacysystems.

PwC19thAnnualGlobalCEOSurvey2016

Asasideeffectoftheincreasingefficiency,competitiveadvantagesmust oftenbelookedforinevermorecomplexproductsortransactions.Thisin turninherentlyincreasesrisksandmakesriskmanagementaswellas oversightandregulationmoreandmoredifficult.Thefinancialcrisisof 2007and2008tellsthestoryofpotentialdangersresultingfromsuch developments.Inasimilarvein,“algorithmsandcomputersgonewild” representapotentialrisktothefinancialmarkets;thismaterialized dramaticallyintheso-called flash crash ofMay2010,whereautomated sellingledtolargeintradaydropsincertainstocksandstockindices. PartIVcoverstopicsrelatedtothealgorithmictradingoffinancial instruments.

TechnologyandTalentasBarrierstoEntry

Ontheonehand,technologyadvancesreducecostovertime, ceteris paribus.Ontheotherhand,financialinstitutionscontinuetoinvestheavily intechnologytobothgainmarketshareanddefendtheircurrentpositions. Tobeactivetodayincertainareasinfinanceoftenbringswithittheneed forlarge-scaleinvestmentsinbothtechnologyandskilledstaff.Asan example,considerthederivativesanalyticsspace:

Aggregatedoverthetotalsoftwarelifecycle,firmsadoptingin-house strategiesforOTC[derivatives]pricingwillrequireinvestmentsbetween $25millionand$36millionalonetobuild,maintain,andenhancea completederivativeslibrary.

Ding(2010)

Notonlyisitcostlyandtime-consumingtobuildafull-fledgedderivatives analyticslibrary,butyoualsoneedtohave enough experts todoso.And theseexpertshavetohavetherighttoolsandtechnologiesavailableto accomplishtheirtasks.WiththedevelopmentofthePythonecosystem, sucheffortshavebecomemoreefficientandbudgetsinthisregardcanbe reducedsignificantlytodaycomparedto,say,10yearsago.PartVcovers derivativesanalyticsandbuildsasmallbutpowerfulandflexible derivativespricinglibrarywithPythonandstandardPythonpackagesalone.

AnotherquoteabouttheearlydaysofLong-TermCapitalManagement (LTCM),formerlyoneofthemostrespectedquantitativehedgefunds— which,however,wentbustinthelate1990s—furthersupportsthisinsight abouttechnologyandtalent:

Meriwetherspent$20milliononastate-of-the-artcomputersystemand hiredacrackteamoffinancialengineerstoruntheshowatLTCM, whichsetupshopinGreenwich,Connecticut.Itwasriskmanagementon anindustriallevel.

Patterson(2010)

ThesamecomputingpowerthatMeriwetherhadtobuyformillionsof dollarsistodayprobablyavailableforthousandsorcanberentedfroma

cloudproviderbasedonaflexiblefeeplan.Chapter2showshowtosetup aninfrastructureinthecloudforinteractivefinancialanalytics,application development,anddeploymentwithPython.Thebudgetsforsucha professionalinfrastructurestartatafewUSDpermonth.Ontheotherhand, trading,pricing,andriskmanagementhavebecomesocomplexforlarger financialinstitutionsthattodaytheyneedtodeployITinfrastructureswith tensofthousandsofcomputingcores.

Ever-IncreasingSpeeds,Frequencies,andDataVolumes

Theonedimensionofthefinanceindustrythathasbeeninfluencedmostby technologicaladvancesisthe speed and frequency withwhichfinancial transactionsaredecidedandexecuted.Lewis(2014)describesso-called flash trading —i.e.,tradingatthehighestspeedspossible—invividdetail.

Ontheonehand,increasingdataavailabilityonever-smallertimescales makesitnecessarytoreactinrealtime.Ontheotherhand,theincreasing speedandfrequencyoftradingmakesthedatavolumesfurtherincrease. Thisleadstoprocessesthatreinforceeachotherandpushtheaveragetime scaleforfinancialtransactionssystematicallydown.Thisisatrendthathad alreadystartedadecadeago:

Renaissance’sMedallionfundgainedanastonishing80percentin2008, capitalizingonthemarket’sextremevolatilitywithitslightning-fast computers.JimSimonswasthehedgefundworld’stopearnerforthe year,pocketingacool$2.5billion.

Patterson(2010)

Thirtyyears’worthofdailystockpricedataforasinglestockrepresents roughly7,500closingquotes.Thiskindofdataiswhatmostoftoday’s financetheoryisbasedon.Forexample,modernormean-varianceportfolio theory(MPT),thecapitalassetpricingmodel(CAPM),andvalue-at-risk (VaR)allhavetheirfoundationsindailystockpricedata.

Incomparison,onatypicaltradingdayduringasingletradinghourthe stockpriceofAppleInc.(AAPL)maybequotedaround15,000times— roughlytwicethenumberofquotescomparedtoavailableend-of-day closingquotesover30years(seetheexamplein“Data-DrivenandAI-First Finance”).Thisbringswithitanumberofchallenges:

Data processing

Itdoesnotsufficetoconsiderandprocessend-of-dayquotesforstocks orotherfinancialinstruments;“toomuch”happensduringtheday,and forsomeinstrumentsduring24hoursfor7daysaweek.

Analytics speed

Decisionsoftenhavetobemadeinmillisecondsorevenfaster,making itnecessarytobuildtherespectiveanalyticscapabilitiesandtoanalyze largeamountsofdatainrealtime.

Theoretical foundations

Althoughtraditionalfinancetheoriesandconceptsarefarfrombeing perfect,theyhavebeenwelltested(andsometimeswellrejected)over time;forthemillisecondandmicrosecondscalesimportantasoftoday, consistentfinancialconceptsandtheoriesinthetraditionalsensethat haveproventobesomewhatrobustovertimearestillmissing.

Allthesechallengescaningeneralonlybeaddressedbymodern technology.Somethingthatmightalsobealittlebitsurprisingisthatthe lackofconsistenttheoriesoftenisaddressedbytechnologicalapproaches, inthathigh-speedalgorithmsexploitmarketmicrostructureelements(e.g., orderflow,bid-askspreads)ratherthanrelyingonsomekindoffinancial reasoning.

TheRiseofReal-TimeAnalytics

Thereisonedisciplinethathasseenastrongincreaseinimportanceinthe financeindustry: financial and data analytics.Thisphenomenonhasaclose relationshiptotheinsightthatspeeds,frequencies,anddatavolumes increaseatarapidpaceintheindustry.Infact,real-timeanalyticscanbe consideredtheindustry’sanswertothistrend.

Roughlyspeaking,“financialanddataanalytics”referstothedisciplineof applyingsoftwareandtechnologyincombinationwith(possiblyadvanced) algorithmsandmethodstogather,process,andanalyzedatainordertogain insights,tomakedecisions,ortofulfillregulatoryrequirements,for instance.Examplesmightincludetheestimationofsalesimpactsinduced byachangeinthepricingstructureforafinancialproductintheretail branchofabank,orthelarge-scaleovernightcalculationofcreditvaluation adjustments(CVA)forcomplexportfoliosofderivativestradesofan investmentbank.

Therearetwomajorchallengesthatfinancialinstitutionsfaceinthis context:

Big data

Banksandotherfinancialinstitutionshadtodealwithmassive amountsofdataevenbeforetheterm“bigdata”wascoined;however, theamountofdatathathastobeprocessedduringsingleanalytics taskshasincreasedtremendouslyovertime,demandingbothincreased computingpowerandever-largermemoryandstoragecapacities.

Real-time economy

Inthepast,decisionmakerscouldrelyonstructured,regularplanning aswellasdecisionand(risk)managementprocesses,whereasthey todayfacetheneedtotakecareofthesefunctionsinrealtime;several tasksthathavebeentakencareofinthepastviaovernightbatchruns inthebackofficehavenowbeenmovedtothefrontofficeandare executedinrealtime.

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.