Trouble Extracting Exchange Fund Flow Data

blockchain-analytics

#1

Hi Team,

I am aiming to extract exchange fund flows data. This is my code:

import san
san.ApiConfig.api_key = ‘MYKEY’

def get(token,sanmetric):
“”"
Function that extracts token from Sanbase for the timeframe from
February 2016 to September 2018 with an interval of 1 day.

INPUT:  tokenname string, sanmetricstring
OUTPUT: returns DataFrame of time series for 
        given sanbase metric
        
Note: Date and interval is currently hard coded into the function 

"""

metric = san.get(
    sanmetric + "/" + token,               
    from_date="2016-02-01",                  
    to_date="2018-09-30", 
    interval="1d"                        
)

return metric

get(“iota”,“exchange_funds_flow”)

Unfortunately I get the following error (I tried for several different tokens and san is correctly initiated):


SanError Traceback (most recent call last)
in ()
----> 1 get(“iota”,“exchange_funds_flow”)

in get(token, sanmetric)
16 from_date=“2016-02-01”,
17 to_date=“2018-09-30”,
—> 18 interval=“1d”
19 )
20

~\Anaconda3\lib\site-packages\san\get.py in get(dataset, **kwargs)
15 gql_query = get_gql_query(0, dataset, **kwargs)
16 gql_query = “{\n” + gql_query + “\n}”
—> 17 res = execute_gql(gql_query)
18 return convert_to_datetime_idx_df(res[“query_0”])

~\Anaconda3\lib\site-packages\san\graphql.py in execute_gql(gql_query_str)
16 else:
17 raise SanError(“Error running query. Status code: {}.\n {} \n errors: {}”
—> 18 .format(response.status_code, gql_query_str, response.json()[‘errors’]))

SanError: Error running query. Status code: 400.
{

query_0: exchangeFundsFlow(
    slug: "iota",
    from: "2016-02-01T00:00:00+00:00",
    to: "2018-09-30T00:00:00+00:00",
    interval: "1d"
){
    datetime,

fundsFlow
}

}
errors: [{‘locations’: [{‘column’: 0, ‘line’: 10}], ‘message’: ‘Cannot query field “fundsFlow” on type “ExchangeFundsFlow”.’}]


#2

Hi Teresa,
Could you please upgrade the library and test again? Your version of the library asks for the fundsFlow field which has been renamed.