Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ jobs:
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
env:
API_KEY: ${{ secrets.API_KEY }}
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: lcov.info
verbose: true
docs:
name: Documentation
runs-on: ubuntu-latest
Expand All @@ -63,4 +67,4 @@ jobs:
- run: julia --project=docs docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
*.jl.mem
/Manifest.toml
/docs/build/
.vscode/
.env
10 changes: 8 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
name = "PolygonIO"
uuid = "8d21102f-33ed-495a-9a0c-ac543572a703"
authors = ["PyDataBlog <bbrenyah@gmail.com> and contributors"]
authors = ["Bernard Brenyah and contributors"]
version = "0.1.0"

[deps]
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"

[compat]
julia = "1"

[extras]
ConfigEnv = "01234589-554d-41b7-ae5c-7b6ee2db6796"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9"

[targets]
test = ["Test"]
test = ["ConfigEnv", "Test", "TypedTables"]
19 changes: 18 additions & 1 deletion src/PolygonIO.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
module PolygonIO

# Write your package code here.
# Gloabl Imports
using JSON3
using HTTP


######### Import modules & utils ################
include("utils.jl")
include("crypto_api.jl")
include("custom_structs.jl")
include("forex_api.jl")
include("reference_api.jl")
include("stock_api.jl")
include("streaming_socket.jl")



######### Global export of user API ################
export tickers, PolyOpts

end
Empty file added src/crypto_api.jl
Empty file.
19 changes: 19 additions & 0 deletions src/custom_structs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
AbstractPolyOptions

Abstract base type for all generic options.
"""
abstract type AbstractPolyOptions end


"""
PolyOpts <: AbstractPolyOptions

# api_key: String representing the API key from a registered polygon.io account.
# table: Boolean value specifying where the results should be tabularized or not.
"""
struct PolyOpts <: AbstractPolyOptions
api_key::String
sink::Any
end

Empty file added src/forex_api.jl
Empty file.
73 changes: 73 additions & 0 deletions src/reference_api.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
############ Tickers ####################
"""
"""
function tickers(opts::PolyOpts,
search::String;
active::Bool=true,
sort::String="ticker",
order::String="asc",
limit::Int=10,
kwargs...)

params = Dict(
"search" => search,
"active" => active,
"sort" => sort,
"order" => order,
"limit" => limit,
"apiKey" => opts.api_key
)
# Extract kwargs and add to params
merge!(params, Dict(kwargs))

request_json = HTTP.get(tickers_base_url, query=params).body |> JSON3.read

if opts.sink === nothing
return request_json.results
else
return request_json.results |> opts.sink
end


end

############ Ticker Types ####################


############ Tickers Details ####################


############ Ticker Details vX ####################


############ Ticker News #######################


############ Markets ####################


############ Locales ####################


############ Stock Splits ####################


############ Stock Dividends ####################


############ Stock Financials ####################


############ Market Holidays ####################


############ Market Status ####################


############ Stock Exchanges ####################


############ Condition Mappings ####################


############ Crypto Exchanges ####################
Empty file added src/stock_api.jl
Empty file.
Empty file added src/streaming_socket.jl
Empty file.
1 change: 1 addition & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tickers_base_url = "https://api.polygon.io/v3/reference/tickers"
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
using ConfigEnv
using PolygonIO
using TypedTables
using Test


dotenv()

const API_KEY = ENV["API_KEY"]

@testset "PolygonIO.jl" begin
# Write your tests here.
@test tickers(PolyOpts(API_KEY, Table), "bitcoin") |> size == (10, )
@test tickers(PolyOpts(API_KEY, nothing), "bitcoin") |> size == (10, )
end