github.com/diadata-org/diadata@v1.4.593/documentation/tutorials/ratescrapers.md (about) 1 # Write your own rate scraper 2 3 These instructions concern writing scrapers for single units characterised by a (floating point) number. For scrapers describing the relation between pairs of units, i.e. exchange rates see the instructions in exchangescrapers.md. 4 5 ## Instructions for the addition of a rate scraper 6 7 In order to add your own scraper for a new data source, you must adhere to our format. Create the package file `UpdateMYRATE.go` in the package `/internal/pkg/ratescrapers`. The central method is ` UpdateMYRATE()`. This method acts on a RateScraper struct which is defined in RateScraper.go in the ratescrapers package. For instance, for the the Euro Short-Term Rate (ESTER) issued by the ECB, `UpdateESTER.go` would look like 8 9 ```go 10 func (s *RateScraper) UpdateESTER() error { 11 // scraper code here 12 } 13 ``` 14 15 The scraped data has to be written into a struct of type InterestRate from `pkg/model/types.go` 16 17 ```go 18 type InterestRate struct { 19 Symbol string 20 Value float64 21 Time time.Time 22 Source string 23 } 24 ``` 25 and sent to the channel chanInterestRate of the RateScraper s. In order to write a new scraper, it is not imperative to understand the architecture of the pathway from top to bottom, but it might be helpful. For a first impression you can have a look at the following [diagram](github.com/diadata-org/diadata/documentation/tutorials/rate_scraper_diagram_down.pdf). 26 27 **Remark**: Parsing xml in go is not always straightforward. A useful resource for parsing can be found here: 28 github.com/gnewton/chidley 29