Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a49c9f0
Update client to implement pytrade interfaces
kylewidmann Feb 12, 2025
3dab271
Updating structure
kylewidmann Feb 13, 2025
24020e2
Adding workflow
kylewidmann Feb 13, 2025
ca6c7b6
Updating poetry version to support github packages
kylewidmann Feb 13, 2025
e78937f
Updating pytrade
kylewidmann Feb 13, 2025
63f7154
Updating pytrade
kylewidmann Feb 14, 2025
84d6f58
Fix client call to close a position
kylewidmann Feb 14, 2025
e0b5fc5
bump pytrade
kylewidmann Feb 14, 2025
34db4d5
Bump pytrade
kylewidmann Feb 14, 2025
e5b9327
bumpy pytrade
kylewidmann Feb 14, 2025
823a6a1
Bump pytrade
kylewidmann Feb 14, 2025
79b44de
Bump pytrade
kylewidmann Feb 14, 2025
573d3f8
Fix leverage property
kylewidmann Feb 14, 2025
ea4cde6
Fix order arg parsing
kylewidmann Feb 14, 2025
0b9efb9
Provide SL/TP order args conditionally
kylewidmann Feb 14, 2025
55da529
Fix close position size check
kylewidmann Feb 14, 2025
9f150ec
Fix unit args for close position
kylewidmann Feb 14, 2025
b20f6be
Fix close position args
kylewidmann Feb 14, 2025
adf630e
Format TP/SL string args to 5 decimal places
kylewidmann Feb 14, 2025
747d319
Adding integration tests for API
kylewidmann Feb 16, 2025
2b0e920
bump pytrade
kylewidmann Feb 16, 2025
9de5b27
lint fixes
kylewidmann Feb 16, 2025
87edba1
Updatig workflow to create v20 config
kylewidmann Feb 16, 2025
338d691
Merge branch 'v1.0.0' into oanda
kylewidmann Feb 16, 2025
948b0c0
debug step for workflow
kylewidmann Feb 16, 2025
09d5b9b
More debug
kylewidmann Feb 16, 2025
55e9cc6
Updating docker compose to mount config from env
kylewidmann Feb 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.coverage
.mypy_cache
.pytest_cache
.venv
docker
*.code-workspace
.dockerignore
htmlcov
**/.coverage
**/.mypy_cache
**/.pytest_cache
**/.venv
**/docker
**/*.code-workspace
**/.dockerignore
**/htmlcov
14 changes: 13 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,16 @@ jobs:

- name: Build
working-directory: .
run: make ci
run: |
touch ~/.v20.conf
echo "hostname: api-fxpractice.oanda.com" >> ~/.v20.conf
echo "streaming_hostname: stream-fxpractice.oanda.com" >> ~/.v20.conf
echo "port: 443" >> ~/.v20.conf
echo "ssl: true" >> ~/.v20.conf
echo "token: ${{ secrets.OANDA_TOKEN }}" >> ~/.v20.conf
echo "username: ${{ secrets.OANDA_USERNAME }}" >> ~/.v20.conf
echo "accounts:" >> ~/.v20.conf
echo "- ${{ secrets.OANDA_ACCOUNT }}" >> ~/.v20.conf
echo "active_account: ${{ secrets.OANDA_ACCOUNT }}" >> ~/.v20.conf

make ci
Empty file removed .gitmodules
Empty file.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
11 changes: 6 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.testing.unittestArgs": [
"-v",
"tests/**/test_*.py"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.terminal.activateEnvironment": true
"debugpy.debugJustMyCode": false,
"python.terminal.activateEnvironment": true,
"python.analysis.extraPaths": [
"../PyTrade",
"../v20-python"
]
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BUILD_NUMBER ?= 0
IMAGE ?= ${PROJECT}:${BRANCH_NAME}-${BUILD_NUMBER}
COMPOSE_FILE=docker/docker-compose.yaml
COMPOSE_BASE_FILE=docker/docker-compose.base.yaml
DC=docker-compose -p ${PROJECT} -f ${COMPOSE_FILE} -f ${COMPOSE_BASE_FILE}
DC=docker compose -p ${PROJECT} -f ${COMPOSE_FILE} -f ${COMPOSE_BASE_FILE}
SERVICE := oanda_client
POETRY ?= "poetry"
VERSION := $(shell head VERSION | grep -Eo "\d+.\d+.\d+")
Expand Down
11 changes: 6 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM python:3.12.2-slim-bookworm as base
FROM python:3.12.2-slim-bookworm AS base

ENV \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
POETRY_VERSION=1.5.1 \
POETRY_VERSION=2.0.1 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
POETRY_HOME="/opt/poetry" \
Expand All @@ -25,13 +25,13 @@ RUN curl -sSL https://install.python-poetry.org | python3 - \

WORKDIR /app/${PROEJCT_DIR}
COPY ${PROEJCT_DIR}/pyproject.toml ${PROEJCT_DIR}/poetry.lock ./
RUN poetry install --only main
RUN poetry install --only main --no-root

##################################################
## PRODUCTION ##
##################################################

FROM python:3.12.2-slim-bookworm as production
FROM python:3.12.2-slim-bookworm AS production

ARG PROEJCT_DIR

Expand Down Expand Up @@ -59,7 +59,7 @@ ENTRYPOINT ["/app/scripts/entrypoint.sh"]
## DEVELOPMENT ##
##################################################

FROM base as development
FROM base AS development

ENV PATH="/app/.venv/bin:$PATH"
ENV APP_USER app
Expand All @@ -74,6 +74,7 @@ RUN set -ex \
WORKDIR /app
COPY --chown=${APP_USER}:${APP_GROUP} . ./
RUN poetry install
RUN chown ${APP_USER}:${APP_GROUP} .
USER ${APP_USER}

ENTRYPOINT ["/app/scripts/entrypoint.sh"]
2 changes: 0 additions & 2 deletions docker/docker-compose.base.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2.4"

services:
base:
image: ${PROJECT}_development:${BRANCH_NAME}-${BUILD_NUMBER}
Expand Down
11 changes: 8 additions & 3 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2.4"

services:

shell:
Expand All @@ -8,7 +6,7 @@ services:
stdin_open: true
tty: true
extends:
file: docker-compose.base.yaml
file: docker-compose.base.yaml
service: base
entrypoint: ["bash"]

Expand Down Expand Up @@ -43,6 +41,13 @@ services:
entrypoint: ["mypy"]

test:
volumes:
- type: bind
source: ~/.v20.conf
target: /config/.v20.conf
environment:
V20_CONFIG: /config/.v20.conf
network_mode: "host"
extends:
file: docker-compose.base.yaml
service: base
Expand Down
2 changes: 1 addition & 1 deletion makefiles/development.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ venv:
buid: ##@development Build the docker images
build: prod_image ?= ${PROJECT}:${BRANCH_NAME}-${BUILD_NUMBER}
build: dev_image ?= ${PROJECT}_development:${BRANCH_NAME}-${BUILD_NUMBER}
build: args ?= -f docker/Dockerfile --build-arg PROJECT_DIR=${PROJECT} --network=host --build-arg BUILDKIT_INLINE_CACHE=1
build: args ?= -f docker/Dockerfile --build-arg PROJECT_DIR=. --network=host --build-arg BUILDKIT_INLINE_CACHE=1
build:
DOCKER_BUILDKIT=1 docker build --progress=plain --target production -t ${prod_image} ${args} .
DOCKER_BUILDKIT=1 docker build --progress=plain --target development -t ${dev_image} --cache-from ${prod_image} ${args} .
Expand Down
7 changes: 3 additions & 4 deletions makefiles/lint.mk
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
.PHONY: bandit
bandit: ##@lint Run bandit
bandit: files ?= ${SERVICE}
bandit: args ?= --configfile=bandit.yaml
bandit:
${DC} run --rm --no-deps bandit -r ${files} ${args}
${DC} run --rm --no-deps bandit -r ${files}

.PHONY: black
black: ##@lint Run black
black: files ?= ${SERVICE} tests
black:
${DC} run --rm --no-deps black -r ${files}
${DC} run --rm --no-deps black ${files}

.PHONY: flake8
flake8: ##@lint Run flake8
flake8: files ?= ${SERVICE} tests
flake8:
${DC} run --rm --no-deps falke8 --config .flake8 ${files}
${DC} run --rm --no-deps flake8 --config .flake8 ${files}

.PHONY: isort
isort: ##@lint Run isort
Expand Down
7 changes: 6 additions & 1 deletion makefiles/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ mypy-local:
lint-local: ##@lint Run lint tools
lint-local: bandit-local black-local flake8-local isort-local mypy-local

.PHONY: clean-imports
clean-imports: ##@local Remove unused imports
clean-imports:
autoflake --in-place --remove-all-unused-imports --recursive oanda_client tests

.PHONY: reformat
reformat: ##@local Reformat module
reformat: files ?= ${SERVICE} tests
reformat:
reformat: clean-imports
${POETRY} run isort --overwrite-in-place ${files}
${POETRY} run black ${files}

Expand Down
4 changes: 2 additions & 2 deletions oanda-client.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"name": "oanda-client"
},
{
"path": "../fx-lib",
"name": "libs/fx-lib"
"path": "../PyTrade",
"name": "libs/PyTrade"
},
{
"path": "../v20-python",
Expand Down
Loading