Skip to content

Front End Function Requirements

Mark7124 edited this page Mar 23, 2017 · 17 revisions

Functions

Listing functions

Function Purpose Returns Example Output
getMarkets Returns a list of markets that data exists for. [
{
UID: number,
name: string
}
]
[
{1500, 'FTSE 100'},
{1400, 'Dow Jones'},
{1232, 'Crude Oil'}
]
getTrendSources Returns a list of trend sources that data exists for. [
{
UID: number,
name: string
}
]
[
'Facebook',
'Twitter'
]
getNewsSources Returns a list of news sources that data exists for. [
{
UID: number,
name: string
}
]
[
'BBC News',
'Reuters'
]

Data request functions

getMarketData(UID: number, startDate: date, endDate: date) Returns data from the market with requested UID, startDate and endDate. If no data exists, the splits property should be set to 0. Otherwise, any data for the requested date range should be returned. {
timePeriod: {
"start": date,
"end": date,
"splits": number
},
data: [number]
}
getMarketData(UID = 1001, startDate = "01/03/2017", endDate = "31/03/2017") =
{
timePeriod: {
"start": "05/03/2017",
"end": "18/03/2017",
"splits": 14
},
data: [
123.3, 423.3, 232.3, 423.3, 434.4, 532.1, 494.2, 246.5, 533.3, 543.2, 423.4, 429.0, 496.7, 382.1
]
}
getTrendData(UID: number, startDate: date, endDate: date) Returns data from the trend source with requested UID, startDate and endDate. If no data exists, the splits property should be set to 0. Otherwise, any data for the requested date range should be returned. {
timePeriod: {
"start": date,
"end": date,
"splits": number
},
data: [number]
}
getTrendData(UID = 2002, startDate = "01/03/2017", endDate = "31/03/2017") =
{
timePeriod: {
"start": "01/03/2017",
"end": "31/03/2017",
"splits": 0
},
data: [
]
}
getNewsLinks(UID: number, startDate: date, endDate: date) Returns links to articles from the news source with requested UID, between startDate and endDate. If no data exists, the array returned should be empty. [
{
"date": date,
"headline": string,
"link": string
}
]
getNewsLinks(UID = 3027, startDate = "01/03/2017", endDate = "31/03/2017") =
[
{
"date": 04/03/2017,
"headline": '\'Defend NHS with all your might\', Corbyn urges demonstrators',
"link": 'https://www.theguardian.com/society/2017/mar/04/nhs-funding-cuts-protest-march-london-jeremy-corbyn'
},
{
"date": 17/03/2017,
"headline": 'Fleeing from Dante\'s hell on Mount Etna',
"link": 'https://www.theguardian.com/world/2017/mar/17/fleeing-from-dantes-hell-on-mount-etna'
}
]

Data Types

Dates

Dates should be strings of format 'dd/mm/yyyy'.

UIDS

UIDs for markets should begin with a 1, and should be tabulated here:

UID Market Name
... ...
UIDs for trend sources should begin with a 2 and should be tabulated here:
UID Trend Source
... ...
UIDs for article sources should begin with a 3, and should be tabulated here:
UID News Article Source
... ...

Clone this wiki locally