-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenBB Script Routines major improvement #5005
Conversation
CC: @the-praxs |
I like this. Your example hints at an extension that would make it even more flexible. Simple date manipulation: END=today # A keyword that grabs the system date |
That's a great idea. we can have some reserved keywords like LASTYEAR, LASTMONTH, LASTWEEK for dates. I'm wondering if there's any other type of keywords that we could use. The offset is interesting but is hard to know what are we offsetting. Days? Months? Years? |
I was thinking days. I would not know exactly what LASTMONTH etc mean. Beginning of last month, end, April 11? Prebaked keywords would be helpful, but I may find them limiting if I want to work with arbitrary offsets from arbitrary dates. Say I'm an academic doing historical research and the baseline from which I want to look at stats is 10-10-2008, going back 3yrs ... END=10-10-2008 |
Rather than I am thinking about 0 vs 1-based indexing. If our user base is less technical, they will find it easier to use 1-based indexing. Programmers are comfortable with 0 already. One cool feature I thought about is to provide the location of the output window for charts/tables i.e. top, center, bottom, or simply a row-column index like (1,2) (depending on the type of indexing) or to simplify more, 1,2,3 where everything goes top to bottom, left to right. |
For
CURRENT_DATE, QUARTER_1/Q1, QUARTER_2/Q2, Q2.DATE, Q2.MONTH etc? |
As a usage example, I would like to have a routine that can query the economic and earnings calendars for the current or upcoming week without the need to explicitly state values for [ |
I think I'd rather for us to create our own convention, e,g. having valid 1YEARAGO, 2YEARSAGO, 3YEARSAGO, ... being valid |
I like ARGV because it's Perl convention, but I understand that INPUT is more straightforward probably for 90% of users. The programmer in my wants do die with 1-based indexing, but for less technical users it may be the right thing to do. The screen position could potentially work. @tehcoderer would it be possible to have optional args for all commands that select where output lands on? Not sure if ROI for that one is worth, but would be good to know if at least possible! QUARTER1, QUARTER2 convention sounds good. Will work on a few improvements over weekend |
Good idea. I'll create a dictionary for us for these 🙏🏽 |
Maybe a smarter way to accomplish all of these, but if it gets the ball rolling, no harm in sharing. :) def date_today() -> datetime:
return (datetime.today())
def date_today_shift(ndays:int = 0) -> datetime:
return (datetime.today() + timedelta(days=ndays))
def last_monday() -> datetime:
if datetime.today().weekday() != 0:
return (datetime.today() + timedelta(datetime.weekday(datetime.today())*(-1)))
else:
return (datetime.today() + timedelta(days = -7))
def next_monday() -> datetime:
if datetime.today().weekday() == 0:
return (datetime.today() + timedelta(days = 7))
else:
return (last_monday()+timedelta(days = 7)) |
Perfect! I will review the code in the mean time and think about some features/keywords. |
Works for me. I'd like to see 1WEEKAGO, 2WEEKSAGO, 1MONTHAGO etc intervals (I,e, near past offsets) |
This should do. Screen.Recording.2023-05-14.at.1.46.35.AM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poetry.lock
file has been changed. Please update both requirements.txt
and requirements-full.txt
files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poetry.lock
file has been changed. Please update both requirements.txt
and requirements-full.txt
files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poetry.lock
file has been changed. Please update both requirements.txt
and requirements-full.txt
files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poetry.lock
file has been changed. Please update both requirements.txt
and requirements-full.txt
files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poetry.lock
file has been changed. Please update both requirements.txt
and requirements-full.txt
files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rocket ship emojiiiii
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poetry.lock
file has been changed. Please update both requirements.txt
and requirements-full.txt
files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poetry.lock
file has been changed. Please update both requirements.txt
and requirements-full.txt
files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poetry.lock
file has been changed. Please update both requirements.txt
and requirements-full.txt
files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The poetry.lock
file has been changed. Please update both requirements.txt
and requirements-full.txt
files
See current state here: https://twitter.com/didier_lopes/status/1656788265293459457?s=20
New features:
tests/openbb_terminal/routines/test_routines.py
- to be run withpytest tests/openbb_terminal/routines/test_routines.py
It doesn't has the capability of taking output from a command, thus the if/else is not a priority as the user controls the inputs. Taking output from command will likely require a big rewrite since that's not something our current infra supports.