Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
jailop committed Dec 27, 2024
1 parent 3cd2250 commit c0abef0
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 13 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ lint:

typing:
mypy .

upload:
twine upload -r pybottrader dist/*
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# PyBotTrader

API Documentation <https://jailop.github.io/pybottrader/pybottrader.html>

PyBotTrader is an experimental Python library designed to help create trading
bots, particularly for retail traders. It offers tools for real-time financial
Expand Down Expand Up @@ -85,7 +84,7 @@ Time Pos. Price ROI Valuation Accum.ROI
## Installation

```sh
pip install pybottrader
pip install git+https://github.com/jailop/pybottrader.git
```

Shortly, I'm going to release more documentation and more examples.
Expand Down
21 changes: 21 additions & 0 deletions data/IBM.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
time,open,high,low,close,volume,dividends,stock splits
1732683600.0,228.8300018310547,229.19000244140625,224.27000427246094,226.9199981689453,2995100,0.0,0.0
1732856400.0,227.75,230.36000061035156,227.19000244140625,227.41000366210938,2640300,0.0,0.0
1733115600.0,227.5,228.3800048828125,225.50999450683594,227.38999938964844,2655900,0.0,0.0
1733202000.0,227.24000549316406,229.11000061035156,226.6699981689453,229.0,3163800,0.0,0.0
1733288400.0,230.0,233.74000549316406,229.35000610351562,233.49000549316406,4104200,0.0,0.0
1733374800.0,233.5500030517578,236.52000427246094,233.4600067138672,234.75,4791100,0.0,0.0
1733461200.0,234.42999267578125,238.3800048828125,234.22000122070312,238.0399932861328,4028400,0.0,0.0
1733720400.0,238.0,239.35000610351562,228.91000366210938,230.0,4970400,0.0,0.0
1733806800.0,228.39999389648438,234.38999938964844,227.8000030517578,231.72000122070312,4769500,0.0,0.0
1733893200.0,232.69000244140625,233.0,229.1300048828125,230.1199951171875,3872700,0.0,0.0
1733979600.0,230.66000366210938,233.88999938964844,230.3800048828125,232.25999450683594,4515700,0.0,0.0
1734066000.0,232.25,233.77999877929688,230.25999450683594,230.82000732421875,2757400,0.0,0.0
1734325200.0,230.72999572753906,231.02999877929688,226.8800048828125,229.3300018310547,3610300,0.0,0.0
1734411600.0,229.22999572753906,230.1999969482422,227.6199951171875,228.97000122070312,3651300,0.0,0.0
1734498000.0,229.0399932861328,229.0399932861328,220.02999877929688,220.1699981689453,4152500,0.0,0.0
1734584400.0,224.4199981689453,226.1999969482422,222.97999572753906,223.9199981689453,4427200,0.0,0.0
1734670800.0,222.72999572753906,227.67999267578125,221.67999267578125,223.36000061035156,12423200,0.0,0.0
1734930000.0,222.80999755859375,223.74000549316406,221.0800018310547,221.92999267578125,2988100,0.0,0.0
1735016400.0,222.27000427246094,224.44000244140625,221.5399932861328,224.41000366210938,1186200,0.0,0.0
1735189200.0,223.30999755859375,225.39999389648438,222.5500030517578,224.88999938964844,3286500,0.0,0.0
2 changes: 1 addition & 1 deletion pybottrader/datastreamers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CSVFileStreamer(DataStreamer):

def __init__(self, filename: str):
self.index = 0
self.data = pd.read_csv(filename, parse_dates=True)
self.data = pd.read_csv(filename)

def next(self) -> Union[dict, None]:
if self.index >= len(self.data):
Expand Down
3 changes: 2 additions & 1 deletion pybottrader/datastreamers/yfinance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from typing import Union
import numpy as np
import pandas as pd
import yfinance
from . import DataStreamer
Expand All @@ -20,12 +21,12 @@ def __init__(self, symbol, *args, **kwargs):
self.data = ticker.history(*args, **kwargs)
self.data.columns = [col.lower() for col in self.data.columns]
self.data.index.names = ["time"]
self.data.index = self.data.index.astype(np.int64) / 1e9
self.data.reset_index(inplace=True)

def next(self) -> Union[dict, None]:
if self.index >= len(self.data):
return None
result = self.data.iloc[self.index].to_dict()
result["time"] = result["time"].to_pydatetime()
self.index += 1
return result
6 changes: 3 additions & 3 deletions pybottrader/indicators/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.15)
project(indicators)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# set(CMAKE_CXX_STANDARD 14)
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_CXX_EXTENSIONS OFF)

if(NOT TARGET pybind11::module)
find_package(pybind11 REQUIRED)
Expand Down
15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ dependencies = [
"numpy",
"pandas",
"yfinance",
"pybind11>=2.6.0",
"pybind11",
"twine",
"PyQt5",
"PyQtChart",
]

[project.urls]
Expand All @@ -23,15 +25,16 @@ package-dir={"" = "."}

[build-system]
requires = [
"setuptools>=42",
"cmake>=3.15",
"pybind11>=2.6.0",
"scikit-build-core>=0.5.0",
"setuptools",
"cmake",
"pybind11",
"scikit-build-core",
"build",
]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
cmake.minimum-version = "3.15"
# cmake.minimum-version = "3.15"
cmake.source-dir = "pybottrader/indicators"
cmake.build-type = "Release"
wheel.packages = ["pybottrader"]
Expand Down

0 comments on commit c0abef0

Please sign in to comment.