-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User convenience function and save to csv
- Loading branch information
Showing
6 changed files
with
256 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,29 @@ | ||
module AllocationOpt | ||
|
||
export optimize_indexer_to_csv! | ||
|
||
using CSV | ||
using DataFrames | ||
|
||
include("exceptions.jl") | ||
include("graphrepository.jl") | ||
include("data.jl") | ||
include("optimize.jl") | ||
|
||
function optimize_indexer_to_csv!(; | ||
id::String, | ||
whitelist::Union{Nothing,Vector{String}}, | ||
blacklist::Union{Nothing,Vector{String}}, | ||
csv_write_path::String, | ||
) | ||
url = "https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-mainnet" | ||
repository = snapshot(; url=url, indexer_query=nothing, subgraph_query=nothing) | ||
alloc, filtered = optimize(id, repository, whitelist, blacklist) | ||
df = DataFrame( | ||
"Subgraph ID" => collect(keys(alloc)), "Allocation in GRT" => collect(values(alloc)) | ||
) | ||
df[!, "Subgraph Signal"] = map(x -> x.signal, filtered.subgraphs) | ||
return CSV.write(csv_write_path, df) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.