amf

package
v0.59.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package amf holds the connectors of the lists the Autorité des marchés financiers publishes daily on data.gouv.fr under the Licence Ouverte 2.0 (docs/sources.md): the blacklist, and the white lists of digital asset service providers (PSAN) and of offers in goods (biens divers). Each list is its own source, with its own snapshot.

Each snapshot row is one key of an entry, looked up by its normalised host, address, phone number or SIREN. Free-text names of the blacklist, which may name natural persons, are left out: no input kind matches them.

Index

Constants

View Source
const (
	// ColumnAMFNumber is the AMF number of the authorisation or offer
	// ("E2020-001", "D-14-01"), "N/A - Passeport" for a provider passported
	// from another EU country.
	ColumnAMFNumber = "no_amf"
	// ColumnName is the provider or offer name, as the AMF lists it.
	ColumnName = "name"
)

Columns of a white list row, after the common ones.

View Source
const (
	// ColumnCountry is the country of the provider's head office, in French.
	ColumnCountry = "country"
	// ColumnAuthorisation is the kind of authorisation ("Enregistrement",
	// "Agrément MICA", "Agrément Pacte").
	ColumnAuthorisation = "authorisation"
	// ColumnStatus is "Agréé" or "Radié".
	ColumnStatus = "status"
	// ColumnAuthorisedFrom is the start date of the authorisation, AAAA-MM-JJ.
	ColumnAuthorisedFrom = "authorised_from"
	// ColumnAuthorisedUntil is its end date, "" while it runs.
	ColumnAuthorisedUntil = "authorised_until"
)

Columns of a PSAN row, after the common ones.

View Source
const (
	// StatusAuthorised is the status of a running authorisation.
	StatusAuthorised = "Agréé"
	// StatusWithdrawn is the status of an authorisation that ended; its row
	// gives the end date.
	StatusWithdrawn = "Radié"
)

Statuses of a PSAN authorisation.

View Source
const BlacklistDatasetURL = "https://www.data.gouv.fr/api/1/datasets/641d5dab1d84b530f7720b08/"

BlacklistDatasetURL is the data.gouv.fr API page of the blacklist dataset.

View Source
const BlacklistSource = signal.AMFSource

BlacklistSource is the name of the AMF blacklist, as shown to users.

View Source
const ColumnRegisteredOn = "registered_on"

ColumnRegisteredOn is the registration date of an offer, AAAA-MM-JJ.

View Source
const OffersDatasetURL = "https://www.data.gouv.fr/api/1/datasets/65709c9cae162fbc34e7ec05/"

OffersDatasetURL is the data.gouv.fr API page of the biens divers dataset.

View Source
const OffersSource = signal.OffersSource

OffersSource is the name of the AMF white list of offers in goods (biens divers: wine, cattle, trees…), as shown to users.

View Source
const PSANDatasetURL = "https://www.data.gouv.fr/api/1/datasets/653135cf052c9a87787413c2/"

PSANDatasetURL is the data.gouv.fr API page of the PSAN dataset.

View Source
const PSANSource = signal.PSANSource

PSANSource is the name of the AMF white list of digital asset service providers (PSAN and MiCA providers), as shown to users.

Variables

View Source
var ErrFormat = errors.New("unexpected AMF file format")

ErrFormat means a file is not laid out as docs/sources.md records it. Errors never quote a value of the file: it may hold an address.

View Source
var ErrResource = errors.New("no single AMF CSV resource")

ErrResource means the dataset metadata does not name exactly one CSV file.

Functions

func BlacklistInfo added in v0.37.0

func BlacklistInfo() domain.SourceInfo

BlacklistInfo describes the AMF blacklist for GET /v1/sources.

func Hosts

func Hosts() []string

Hosts returns the hosts a Fetcher reaches, for the HTTP client allowlist: the data.gouv.fr API and the object store that serves the files.

func OffersInfo added in v0.37.0

func OffersInfo() domain.SourceInfo

OffersInfo describes the AMF white list of offers in goods for GET /v1/sources.

func OffersWhitelist added in v0.26.0

func OffersWhitelist(snap domain.Snapshot, platforms domain.Platforms) (*domain.Whitelist, error)

OffersWhitelist indexes a biens divers snapshot, for listing.NewWhitelistReader, leaving out the pages of platforms (listing.WhitelistOf).

func PSANInfo added in v0.37.0

func PSANInfo() domain.SourceInfo

PSANInfo describes the AMF white list of digital asset service providers for GET /v1/sources.

func PSANWhitelist added in v0.26.0

func PSANWhitelist(snap domain.Snapshot, platforms domain.Platforms) (*domain.Whitelist, error)

PSANWhitelist indexes a PSAN snapshot, for listing.NewWhitelistReader, leaving out the pages of platforms (listing.WhitelistOf). A withdrawn authorisation ends on its end date; a running one has none.

func ParseBlacklist added in v0.16.0

func ParseBlacklist(r io.Reader) (domain.Snapshot, error)

ParseBlacklist reads the published CSV file into a snapshot, one row per site or address. Free-text names are left out. A file that departs from the recorded format is rejected with ErrFormat rather than half read.

func ParseOffers added in v0.16.0

func ParseOffers(r io.Reader) (domain.Snapshot, error)

ParseOffers reads the published CSV file into a snapshot, one row per site and phone number of a registered offer. An offer with neither gives no row.

func ParsePSAN added in v0.16.0

func ParsePSAN(r io.Reader) (domain.Snapshot, error)

ParsePSAN reads the published CSV file into a snapshot, one row per key of a provider's authorisation: each site, address, phone number and, for a French provider, SIREN. The file has one record per activity; records that give the same row merge. A contact page in the e-mail column and a foreign registry number are not keys and are left out.

Types

type Fetcher

type Fetcher struct {
	// contains filtered or unexported fields
}

Fetcher downloads and parses one AMF list. It implements app.SourceFetcher.

func NewBlacklist added in v0.16.0

func NewBlacklist(client Getter, datasetURL string) *Fetcher

NewBlacklist returns the Fetcher of the blacklist, which reads the dataset metadata at datasetURL, BlacklistDatasetURL in production, through client.

func NewOffers added in v0.16.0

func NewOffers(client Getter, datasetURL string) *Fetcher

NewOffers returns the Fetcher of the biens divers white list, which reads the dataset metadata at datasetURL, OffersDatasetURL in production, through client.

func NewPSAN added in v0.16.0

func NewPSAN(client Getter, datasetURL string) *Fetcher

NewPSAN returns the Fetcher of the PSAN white list, which reads the dataset metadata at datasetURL, PSANDatasetURL in production, through client.

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(ctx context.Context) (domain.Snapshot, error)

Fetch resolves the current file from the dataset metadata, downloads it and parses it.

func (*Fetcher) Spec

func (f *Fetcher) Spec() domain.SnapshotSpec

Spec declares the snapshot columns and the least number of rows.

type Getter

type Getter interface {
	Get(ctx context.Context, rawURL string) ([]byte, error)
}

Getter fetches a URL; *httpclient.Client is one.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL