mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-25 10:42:58 +00:00
Merge branch 'feature/openbb-sdk-v4' into feature/integration-testing
This commit is contained in:
95
.github/workflows/api-integration-test.yml
vendored
Normal file
95
.github/workflows/api-integration-test.yml
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
name: API Integration Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- feature/openbb-sdk-v4
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
api-integration-tests:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
|
||||
steps:
|
||||
- name: Slack Notification - Starting
|
||||
uses: act10ns/slack@v1
|
||||
with:
|
||||
status: starting
|
||||
channel: '#workflows'
|
||||
message: Starting Integration Test...
|
||||
if: always()
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Checkout specific ref
|
||||
if: github.event_name == 'pull_request'
|
||||
run: git fetch origin ${{ github.event.pull_request.head.ref }} && git checkout FETCH_HEAD
|
||||
|
||||
- name: Setup Python 3.8
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.8"
|
||||
architecture: x64
|
||||
|
||||
- name: Install Poetry and TOML
|
||||
run: |
|
||||
pip install toml
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
version: 1.4.0
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
|
||||
- name: Load cached venv
|
||||
id: cached-poetry-dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .venv
|
||||
key: venv-${{ runner.os }}-v1-${{ hashFiles('**/poetry.lock') }}
|
||||
|
||||
- name: Install obb Dependencies
|
||||
run: |
|
||||
python openbb_platform/dev_install.py -e
|
||||
|
||||
- name: Populate Setting Files
|
||||
run: |
|
||||
touch $HOME/openbb_platform/user_settings.json
|
||||
echo '{"log_collect":false}' > $HOME/openbb_platform/user_settings.json
|
||||
|
||||
- name: Launch the Uvicorn Process
|
||||
run: |
|
||||
uvicorn openbb_core.api.rest_api:app --host 0.0.0.0 --port 8000 --reload &
|
||||
|
||||
- name: Wait for 1 minute
|
||||
run: |
|
||||
sleep 60
|
||||
|
||||
- name: Run Integration Tests
|
||||
run: |
|
||||
pytest -m integration
|
||||
|
||||
# - name: Upload summary to Slack
|
||||
# uses: adrey/slack-file-upload-action@master
|
||||
# with:
|
||||
# token: ${{ secrets.SLACK_API_TOKEN }}
|
||||
# initial_comment: "API Integration test summary"
|
||||
# title: "Integration test summary"
|
||||
# path: summary.txt
|
||||
# channel: ${{ secrets.SLACK_CHANNEL_ID }}
|
||||
|
||||
# - name: Slack Notification - Success/Failure
|
||||
# uses: act10ns/slack@v1
|
||||
# with:
|
||||
# status: ${{ job.status }}
|
||||
# steps: ${{ toJson(steps) }}
|
||||
# channel: '#workflows'
|
||||
# if: always()
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import List, Literal, Optional
|
||||
|
||||
import pandas as pd
|
||||
import pandas_ta as ta
|
||||
from openbb_core.app.model.obbject import OBBject
|
||||
from openbb_core.app.router import Router
|
||||
from openbb_core.app.utils import (
|
||||
@@ -10,12 +11,7 @@ from openbb_core.app.utils import (
|
||||
get_target_columns,
|
||||
)
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import (
|
||||
NonNegativeFloat,
|
||||
NonNegativeInt,
|
||||
PositiveFloat,
|
||||
PositiveInt,
|
||||
)
|
||||
from pydantic import NonNegativeFloat, NonNegativeInt, PositiveFloat, PositiveInt
|
||||
|
||||
from . import ta_helpers
|
||||
|
||||
@@ -555,18 +551,10 @@ def demark(
|
||||
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
|
||||
>>> demark_data = obb.ta.demark(data=stock_data.results,offset=0)
|
||||
"""
|
||||
|
||||
df = basemodel_to_df(data, index=index)
|
||||
df_target = get_target_column(df, target).to_frame()
|
||||
demark_df = pd.DataFrame(
|
||||
df_target.ta.td_seq(
|
||||
offset=offset,
|
||||
show_all=show_all,
|
||||
asint=asint,
|
||||
close=target,
|
||||
prefix=target,
|
||||
).dropna()
|
||||
)
|
||||
demark = ta.td_seq(df_target[target], asint=asint, show_all=show_all, offset=offset)
|
||||
demark_df = pd.DataFrame(demark).set_index(df_target.index).dropna()
|
||||
|
||||
results = df_to_basemodel(df_target.join(demark_df, how="left"), index=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user