Skip to content

Commit

Permalink
Merge pull request #44 from mraniki/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mraniki authored Apr 26, 2023
2 parents 9892533 + 6d6a65b commit c21a22b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#used by https://github.com/Ezard/semantic-prs automatic check
anyCommit: true
commitsOnly: true
2 changes: 0 additions & 2 deletions .github/semantic.yml.archive

This file was deleted.

13 changes: 12 additions & 1 deletion .github/workflows/🐍build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ jobs:
repository_username: __token__
repository_password: ${{ secrets.PYPI_API_TOKEN }}
#additional_options: --major


#
# BREAKING CHANGE:
# feat: A new feature
# fix: A bug fix
# docs: Documentation only changes
# style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
# refactor: A code change that neither fixes a bug nor adds a feature
# perf: A code change that improves performance
# test: Adding missing or correcting existing tests
# chore: Changes to the build process or auxiliary tools and libraries such as documentation generation



5 changes: 3 additions & 2 deletions findmyorder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def search(self,message_to_parse: str = None,):
def identify_order(self,mystring: str = None,):
# Define the grammar for parsing orders
action = oneOf("BUY SELL LONG SHORT")
print(settings.identifier)
currency_pair = Word(alphas, exact=6)
market = Optional(Word(alphas, exact=4))
leverage = Regex(r'Leverage: \w+ \((\d+(\.\d+)?X)\)')('leverage')
Expand All @@ -57,7 +58,7 @@ def identify_order(self,mystring: str = None,):

def get_order(self,mystring: str = None,):
try:
self.logger.debug(f"identify_order_element for {mystring}")
self.logger.debug(f"get_order for {mystring}")

if (self.search(mystring)):

Expand All @@ -84,6 +85,6 @@ def get_order(self,mystring: str = None,):
return order

except Exception as e:
self.logger.debug(f"error identify_order_element {e}")
self.logger.debug(f"error {e}")
return

25 changes: 15 additions & 10 deletions tests/examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from fastapi import FastAPI
import uvicorn

from findmyorder import findmyorder
from findmyorder import __version__

logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level='DEBUG')
logger = logging.getLogger(__name__)

from findmyorder import findmyorder
logger.debug(f"findmyorder logger: {__name__} version: {__version__}")

async def main():
while True:
Expand All @@ -16,23 +18,26 @@ async def main():
msg_order = "this is a test"

order = fmo.search(msg_order)
logger.debug(f"Order identified: {order}")
logger.debug(f"search 1: {order}")
order = fmo.get_order(msg_order)
logger.debug(f"Order identified: {order}")
logger.debug(f"get_order 1: {order}")

msg_order = "buy btc"

order = fmo.search(msg_order)
logger.debug(f"Order identified: {order}")
order = fmo.get_order(msg_order)
logger.debug(msg=f"Order identified: {order}")
logger.debug(msg=f"get_order 2: {order}")

msg_order = "SELL BTC 1%"
order = fmo.get_order(msg_order)
logger.debug(f"get_order 3 : {order}")

order = fmo.search(msg_order)
logger.debug(f"Order identified: {order}")
msg_order = "SELL BTCUSDT 1%"
order = fmo.get_order(msg_order)
logger.debug(f"get_order 4 : {order}")

msg_order = "buy EURUSD sl=1000 tp=1000 q=1 comment=FOMC"
order = fmo.get_order(msg_order)
logger.debug(f"Order identified: {order}")
logger.debug(f"get_order 5 : {order}")


await asyncio.sleep(10000)
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fastapi>=0.95.1
uvicorn>=0.21.0
findmyorder>=0.0.28
findmyorder>=1.0.1

0 comments on commit c21a22b

Please sign in to comment.