Skip to content

Commit

Permalink
Merge branch 'master' into feature/gmePO-extraction-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MicheleNan authored Jul 5, 2024
2 parents 29d0f58 + 4e43ac6 commit 7980b55
Show file tree
Hide file tree
Showing 9 changed files with 272 additions and 78 deletions.
122 changes: 62 additions & 60 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,89 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Artesian SDK Python
name: Artesian SDK Python

on:
push:
branches: [ master ]
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
branches: [master]
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:

runs-on: ${{ matrix.os }}

strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run flake8
run: |
flake8 .
- name: Run flake8
run: |
flake8 .
- uses: jordemort/action-pyright@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
lib:
level: warning
filter_mode: file
# Execute jordemort/action-pyright only into Ubuntu and macOS.
# windows started to fail for reviewdog not found. issue opened
# https://github.com/jordemort/action-pyright/issues/51
- name: Run Pyright
if: matrix.os != 'windows-latest'
uses: jordemort/action-pyright@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
lib:
level: warning
filter_mode: file

- name: Test Pytest
run: |
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Test Pytest
run: |
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
needs: build
env:
python-version: '3.11'
python-version: "3.11"

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build package
run: |
python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}


- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build package
run: |
python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,6 @@ auctionRows = MarketData.UpsertData(MarketData.MarketDataIdentifier('PROVIDER',

```


## Delete Data in Artesian

Using the MarketDataService is possible to delete MarketData and its curves.
Expand All @@ -808,7 +807,7 @@ mkservice.deleteMarketData(100042422)

```

Depending on the Type of the MarketData, the DeletData should be composed as per example below.
Depending on the Type of the MarketData, the DeletData should be composed as per example below. The timezone is optional: for DateSeries if provided must be equal to MarketData OriginalTimezone Default:MarketData OriginalTimezone. For TimeSeries Default:CET

### Delete Data in an Actual Time Series

Expand Down
25 changes: 23 additions & 2 deletions samples/TestWriteDataAndDeleteActual.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

print(res)

#Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
timezone="CET",
Expand All @@ -66,5 +66,26 @@

print(res)

#Delete the curve completely

# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00 without Timezone
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
rangeStart=datetime(2020, 1, 1, 6),
rangeEnd=datetime(2020, 1, 1, 18),
)

mkdservice.deleteData(deleteData)

res = (
query.createActual()
.forMarketData([registered.marketDataId])
.inAbsoluteDateRange("2020-01-01", "2020-01-02")
.inTimeZone("CET")
.inGranularity(Granularity.Hour)
.execute()
)

print(res)

# Delete the curve completely
mkdservice.deleteMarketData(registered.marketDataId)
23 changes: 21 additions & 2 deletions samples/TestWriteDataAndDeleteAuction.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

print(res)

#Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
timezone="CET",
Expand All @@ -78,5 +78,24 @@

print(res)

#Delete the curve completely
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00 without Timezone
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
rangeStart=datetime(2020, 1, 1, 6),
rangeEnd=datetime(2020, 1, 1, 18),
)

mkdservice.deleteData(deleteData)

res = (
query.createAuction()
.forMarketData([registered.marketDataId])
.inAbsoluteDateRange("2020-01-01", "2020-01-02")
.inTimeZone("CET")
.execute()
)

print(res)

# Delete the curve completely
mkdservice.deleteMarketData(registered.marketDataId)
25 changes: 23 additions & 2 deletions samples/TestWriteDataAndDeleteBidAsk.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

print(res)

#Delete data between 2020-01-01 6am and 2020-01-01 6pm for product Feb-18
# Delete data between 2020-01-01 6am and 2020-01-01 6pm for product Feb-18
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
timezone="CET",
Expand All @@ -78,5 +78,26 @@

print(res)

#Delete the curve completely
# Delete data between 2020-01-01 6am and 2020-01-01 6pm for product Feb-18 without Timezone
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
rangeStart=datetime(2020, 1, 1, 6),
rangeEnd=datetime(2020, 1, 1, 18),
product=["Feb-20"]
)

mkdservice.deleteData(deleteData)

res = (
query.createBidAsk()
.forMarketData([registered.marketDataId])
.inAbsoluteDateRange("2020-01-01", "2020-01-31")
.forProducts(["Feb-20", "Mar-20"])
.inTimeZone("CET")
.execute()
)

print(res)

# Delete the curve completely
mkdservice.deleteMarketData(registered.marketDataId)
25 changes: 23 additions & 2 deletions samples/TestWriteDataAndDeleteMas.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

print(res)

#Delete data with product Feb-20 between 2020-01-01 and 2020-01-03
# Delete data with product Feb-20 between 2020-01-01 and 2020-01-03
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
timezone="CET",
Expand All @@ -78,5 +78,26 @@

print(res)

#Delete the curve completely
# Delete data with product Feb-20 between 2020-01-01 and 2020-01-03 without Timezone
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
rangeStart=datetime(2020, 1, 1, 0),
rangeEnd=datetime(2020, 1, 3, 0),
product=["Feb-20"]
)

mkdservice.deleteData(deleteData)

res = (
query.createMarketAssessment()
.forMarketData([registered.marketDataId])
.inAbsoluteDateRange("2020-01-01", "2020-01-02")
.forProducts(["Feb-20", "Mar-20"])
.inTimeZone("CET")
.execute()
)

print(res)

# Delete the curve completely
mkdservice.deleteMarketData(registered.marketDataId)
26 changes: 24 additions & 2 deletions samples/TestWriteDataAndDeleteVersioned.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

print(res)

#Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
timezone="CET",
Expand All @@ -73,5 +73,27 @@

print(res)

#Delete the curve completely
# Delete data between 2020-01-01 06:00 and 2020-01-01 18:00 without Timezone
deleteData = Artesian.MarketData.DeleteData(
ID=Artesian.MarketData.MarketDataIdentifier(registered.providerName, registered.marketDataName),
rangeStart=datetime(2020, 1, 1, 6),
rangeEnd=datetime(2020, 1, 1, 18),
version=testVersion
)

mkdservice.deleteData(deleteData)

res = (
query.createVersioned()
.forMarketData([registered.marketDataId])
.inAbsoluteDateRange("2020-01-01", "2020-01-02")
.inTimeZone("CET")
.inGranularity(Granularity.Hour)
.forVersion("2020-01-01T12:00:00")
.execute()
)

print(res)

# Delete the curve completely
mkdservice.deleteMarketData(registered.marketDataId)
7 changes: 4 additions & 3 deletions src/Artesian/MarketData/_Dto/DeleteData.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ class DeleteData:
Attributes:
ID: the MarketDataIdentifier
timezone: the Timezone of the rows. Must be the OriginalTimezone
when writing Dates or must be ""UTC"" when writing Times
rangeStart: LocalDateTime start of the range to be deleted
rangeEnd: LocalDateTime end of the range to be deleted
timezone: For DateSeries if provided must be equal to MarketData
OriginalTimezone Default:MarketData OriginalTimezone.
For TimeSeries Default:CET
product: The list of Product. Only *,
is special character for 'delete all products in the range'
version: the Version to operate on
Expand All @@ -25,9 +26,9 @@ class DeleteData:
"""

ID: MarketDataIdentifier
timezone: str
rangeStart: datetime
rangeEnd: datetime
timezone: Optional[str] = None
product: Optional[List[str]] = None
version: Optional[datetime] = None
deferCommandExecution: bool = False
Expand Down
Loading

0 comments on commit 7980b55

Please sign in to comment.