Posts

Showing posts with the label xlwings

use xlwings to run python code in excel

use xlwings to run python code in excel I have a problem running python code by xlwings in excel. My vba code is: Sub Practice() RunPython ("import practice; practice.getdata()") End Sub My python code is practice.py in pycharm. I use the python code to connect to the deribit api and then use excel to run the python code to download data from deribit api to excel. My python code is the following: import pprint import xlwings as xw import pandas as pd import numpy as np from openpyxl.utils.dataframe import dataframe_to_rows from openpyxl import Workbook from deribit_api import RestClient def getdata(): access_key = "6wvUvxmVSoJq" access_secret = "HQQ7ZTU2ZESOR2UELLVSHCRWSHPP2VYE" url = "https://test.deribit.com" client = RestClient(access_key, access_secret, url) client.index() positions = client.positions() account = client.account() dfp = pd.DataFrame(columns=['Kind', 'Expiry Date', 'Direction', 'Underlying', ...