-
Notifications
You must be signed in to change notification settings - Fork 3
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
Request for enhancement #21
Comments
Hey currently not planned. I just expose the ranges that are supported by Yahoo internally (i.e. I send the range and interval as a query parameter and these are the only ones Yahoo accepts). I generally always use the You could for example do the following: using YFinance
using Dates
function get_prices_r(ticker::String,range::Union{TimePeriod,DatePeriod};args...)
startdt,enddt = now()-range, now()
get_prices(ticker; startdt=startdt,enddt=enddt,args...)
end
get_prices_r("AMD",Day(10))
# Output:
OrderedCollections.OrderedDict{String, Any} with 8 entries:
"ticker" => "AMD"
"timestamp" => [DateTime("2024-08-30T13:30:00"), DateTime("2024-09-03T13:30:00"), DateTime("2024-09-04T13:30:00"), DateTime("2024-09-05T13:30:00"), DateTime("2024-09-06T13:30:00")]
"open" => [147.52, 146.41, 140.51, 138.2, 138.7]
"high" => [148.99, 146.49, 143.37, 141.71, 139.13]
"low" => [145.25, 136.1, 138.51, 137.83, 132.11]
"close" => [148.56, 136.94, 140.87, 139.44, 134.35]
"adjclose" => [148.56, 136.94, 140.87, 139.44, 134.35]
"vol" => [3.11691e7, 4.21727e7, 4.21306e7, 2.5023e7, 3.99435e7]
get_prices_r("AMD",Year(1))
# Output:
OrderedCollections.OrderedDict{String, Any} with 8 entries:
"ticker" => "AMD"
"timestamp" => [DateTime("2023-09-11T13:30:00"), DateTime("2023-09-12T13:30:00"), DateTime("2023-09-13T13:30:00"), DateTime("2023-09-14T13:30:00"), DateTime("2023-09-15T13:30:00"), DateTime("2023-09-1…
"open" => [107.32, 104.2, 105.1, 108.43, 106.07, 100.82, 101.75, 102.36, 98.6, 96.92 … 153.6, 154.7, 150.13, 149.4, 146.59, 147.52, 146.41, 140.51, 138.2, 138.7]
"high" => [107.51, 106.74, 108.74, 109.15, 106.76, 102.99, 102.86, 103.94, 98.87, 98.42 … 156.4, 158.28, 151.7, 150.43, 149.49, 148.99, 146.49, 143.37, 141.71, 139.13]
"low" => [103.0, 103.18, 104.83, 106.22, 101.28, 99.45, 100.7, 100.28, 95.84, 95.61 … 151.83, 148.91, 148.44, 144.72, 144.47, 145.25, 136.1, 138.51, 137.83, 132.11]
"close" => [105.32, 105.31, 107.71, 106.63, 101.49, 102.37, 101.61, 100.34, 96.11, 96.2 … 154.98, 149.99, 150.5, 146.36, 145.49, 148.56, 136.94, 140.87, 139.44, 134.35]
"adjclose" => [105.32, 105.31, 107.71, 106.63, 101.49, 102.37, 101.61, 100.34, 96.11, 96.2 … 154.98, 149.99, 150.5, 146.36, 145.49, 148.56, 136.94, 140.87, 139.44, 134.35]
"vol" => [5.06113e7, 4.44136e7, 4.47023e7, 4.59206e7, 7.10176e7, 4.90613e7, 4.17041e7, 5.51806e7, 5.96286e7, 5.21694e7 … 4.36946e7, 4.98933e7, 3.51027e7, 3.40758e7, 3.16021e7, 3.11691e7, 4.217…
get_prices_r("AMD",Month(4))
rderedCollections.OrderedDict{String, Any} with 8 entries:
"ticker" => "AMD"
"timestamp" => [DateTime("2024-05-09T13:30:00"), DateTime("2024-05-10T13:30:00"), DateTime("2024-05-13T13:30:00"), DateTime("2024-05-14T13:30:00"), DateTime("2024-05-15T13:30:00"), DateTime("2024-05-1…
"open" => [153.13, 154.29, 151.28, 150.43, 155.59, 160.92, 168.43, 165.55, 164.0, 167.41 … 153.6, 154.7, 150.13, 149.4, 146.59, 147.52, 146.41, 140.51, 138.2, 138.7]
"high" => [154.09, 156.37, 153.33, 153.49, 159.69, 168.06, 169.72, 168.49, 165.83, 169.81 … 156.4, 158.28, 151.7, 150.43, 149.49, 148.99, 146.49, 143.37, 141.71, 139.13]
"low" => [150.61, 151.31, 150.4, 148.78, 154.7, 159.9, 162.32, 164.47, 163.1, 163.86 … 151.83, 148.91, 148.44, 144.72, 144.47, 145.25, 136.1, 138.51, 137.83, 132.11]
"close" => [152.39, 151.92, 150.56, 153.16, 159.67, 162.62, 164.47, 166.33, 164.66, 165.52 … 154.98, 149.99, 150.5, 146.36, 145.49, 148.56, 136.94, 140.87, 139.44, 134.35]
"adjclose" => [152.39, 151.92, 150.56, 153.16, 159.67, 162.62, 164.47, 166.33, 164.66, 165.52 … 154.98, 149.99, 150.5, 146.36, 145.49, 148.56, 136.94, 140.87, 139.44, 134.35]
"vol" => [3.3018e7, 3.76528e7, 2.78592e7, 3.19383e7, 4.31959e7, 7.67267e7, 6.59444e7, 4.5618e7, 3.00055e7, 4.74267e7 … 4.36946e7, 4.98933e7, 3.51027e7, 3.40758e7, 3.16021e7, 3.11691e7, 4.21727…
get_prices_r("AMD",Minutes(5)) # This will error when markets are closed (more info below)
|
Dear Elias,
This a request for enhancement rather than an issue.
Is it possible that you accept an arbitrary range in your get_prices function? for example, 10d, 15y ... and so on? If it is possible, it would help me a lot.
Thank you.
Vicente
The text was updated successfully, but these errors were encountered: