Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jialuechen committed Jul 21, 2024
1 parent 51d2dc0 commit ba63361
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align=center>
<img src="assets/pytca-logo.png" width="40%" loc>
<img src="assets/img/pytca-logo.png" width="40%" loc>
</div>

<div align=center>
Expand Down
File renamed without changes
21 changes: 21 additions & 0 deletions examples/performing_analysis.py
Original file line number Diff line number Diff line change
@@ -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)
20 changes: 20 additions & 0 deletions examples/visualization_example.py
Original file line number Diff line number Diff line change
@@ -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')
2 changes: 1 addition & 1 deletion pytca/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__title__ = 'pytca'
__version__ = '0.1.3'
__version__ = '1.0.0'
__author__ = 'Jialue Chen'
__license__ = 'BSD 2-Clause'

0 comments on commit ba63361

Please sign in to comment.