open source in quant finance - xlwings
TRANSCRIPT
![Page 1: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/1.jpg)
xlwings Open Source in Quant Finance Conference
(Frankfurt/Eschborn)
5 June 2015 Felix Zumstein, CFA
![Page 2: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/2.jpg)
About me • Startup (2014, Zurich): – Mainly Python for Finance – Web based trading solutions (Interactive Brokers) – Lots of Excel – Open-source: xlwings/ExcelPython • Previously: 9yrs in Banking /Asset Mgmt • Background in Finance & Economics
2
![Page 3: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/3.jpg)
What’s in this talk?
3
![Page 4: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/4.jpg)
The open-source Python/Excel Landscape
4
• Pywin32 • xlwings • ExcelPython
Read/Write Program/Interact • xlwt/xlrd • XlsxWriter • OpenPyxl
![Page 5: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/5.jpg)
Why xlwings? – 6 Reasons
5
![Page 6: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/6.jpg)
(1) Installation
6
• pip/conda install xlwings • or equally easy:
![Page 7: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/7.jpg)
(2) Cross-Platform
7
+
![Page 8: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/8.jpg)
(3) Flexibility
8
Version
2.6 2.7 3.1 3.2 3.3 3.4
32-bit 64-bit
32-bit 64-bit
2003 2010 2011 (Mac) 2013 2016 (Win + Mac*)
Architecture Version Architecture
*under development
![Page 9: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/9.jpg)
(4) Simplicity
9
>>> from xlwings import Workbook, Range
>>> wb = Workbook() >>> Range("A1").value = my_variable
• Strings • Numbers • DateTime • Lists (nested) • NumPy arrays • Pandas DataFrames • Blaze Data container (planned)
![Page 10: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/10.jpg)
(5) Works back and forth
10
>>> wb = Workbook() >>> Range("A1").value = my_variable
Sub MyFunction() RunPython ("import mymodule;mymodule.myfunction()") End Sub
![Page 11: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/11.jpg)
(6) ExcelPython for UDFs (Windows only)
11
from xlpython import xlfunc import numpy as np
@xlfunc def matrix_mult(x, y): x = np.atleast_2d(np.array(x)) y = np.atleast_2d(np.array(y)) return x.dot(y)
{=matrix_mult(A1:B2,D1:E2)}
Access from Excel via Array Formula:
Write User Defined Functions in Python:
![Page 12: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/12.jpg)
What’s next?
12
![Page 13: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/13.jpg)
What’s next?
• Add-in • Full integration of xlwings/ExcelPython • Add more features: matplotlib etc. • Someday… – Google Sheets – LibreOffice/OpenOffice
13
![Page 14: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/14.jpg)
julia> using PyCall julia> @pyimport xlwings as xw julia> xw.Workbook() julia> xw.Range("A1", asarray=true)[:table][:value]
Use xlwings from Julia
14
>>> from xlwings import Workbook, Range
>>> wb = Workbook() >>> Range("A1", asarray=True).table.value
![Page 15: Open Source in Quant Finance - xlwings](https://reader030.vdocument.in/reader030/viewer/2022013118/55c06c4ebb61eb933e8b46b0/html5/thumbnails/15.jpg)
DEMO xlwings.org
15