From ba6336137028902dea7b3f9e7feb723a0c21ff8a Mon Sep 17 00:00:00 2001 From: Jialue Chen Date: Sun, 21 Jul 2024 19:12:23 -0400 Subject: [PATCH] add examples --- README.md | 2 +- assets/{ => img}/pytca-logo.png | Bin examples/performing_analysis.py | 21 +++++++++++++++++++++ examples/visualization_example.py | 20 ++++++++++++++++++++ pytca/__init__.py | 2 +- 5 files changed, 43 insertions(+), 2 deletions(-) rename assets/{ => img}/pytca-logo.png (100%) create mode 100644 examples/performing_analysis.py create mode 100644 examples/visualization_example.py diff --git a/README.md b/README.md index a6690b4..f9efbcf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
- +
diff --git a/assets/pytca-logo.png b/assets/img/pytca-logo.png similarity index 100% rename from assets/pytca-logo.png rename to assets/img/pytca-logo.png diff --git a/examples/performing_analysis.py b/examples/performing_analysis.py new file mode 100644 index 0000000..127b0f1 --- /dev/null +++ b/examples/performing_analysis.py @@ -0,0 +1,21 @@ +import pytca + +# Load data +stock_data = pytca.load_tick_data('path/to/stock_data.csv', data_type='stock') +forex_data = pytca.load_tick_data('path/to/forex_data.csv', data_type='forex') + +# Analyze stock data +stock_analysis = pytca.analyze_stock_trade(stock_data, benchmark_data) +print("Stock Analysis Results:", stock_analysis) + +# Analyze forex data +forex_analysis = pytca.analyze_forex_trade(forex_data, benchmark_data) +print("Forex Analysis Results:", forex_analysis) + +# Calculate slippage +slippage = pytca.calculate_slippage(executed_price=100.05, benchmark_price=100.00) +print("Slippage:", slippage) + +# Calculate VWAP +vwap = pytca.calculate_vwap(prices=[100.00, 100.05, 100.10], volumes=[1000, 2000, 1500]) +print("VWAP:", vwap) \ No newline at end of file diff --git a/examples/visualization_example.py b/examples/visualization_example.py new file mode 100644 index 0000000..d30628e --- /dev/null +++ b/examples/visualization_example.py @@ -0,0 +1,20 @@ +import pytca + +# Load data +tick_data = pytca.load_tick_data('path/to/tick_data.csv', data_type='stock') + +# Create basic plot +basic_fig = pytca.plot_tick_data(tick_data, plot_type='basic') +basic_fig.savefig('basic_plot.png') + +# Create candlestick chart +candlestick_fig = pytca.plot_tick_data(tick_data, plot_type='candlestick', interval='5min') +candlestick_fig.write_html('candlestick.html') + +# Create order book depth chart +depth_fig = pytca.plot_tick_data(tick_data, plot_type='depth') +depth_fig.write_html('depth_chart.html') + +# Create trade flow chart +trade_flow_fig = pytca.plot_tick_data(tick_data, plot_type='trade_flow', window='5min') +trade_flow_fig.write_html('trade_flow.html') \ No newline at end of file diff --git a/pytca/__init__.py b/pytca/__init__.py index 70505c0..ae2338d 100644 --- a/pytca/__init__.py +++ b/pytca/__init__.py @@ -1,4 +1,4 @@ __title__ = 'pytca' -__version__ = '0.1.3' +__version__ = '1.0.0' __author__ = 'Jialue Chen' __license__ = 'BSD 2-Clause' \ No newline at end of file