File size: 2,014 Bytes
f5cd2d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.rods.backtestingstrategies.entity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;


@Entity
@Table(
        name = "stock_symbols",
        uniqueConstraints = {
                @UniqueConstraint(columnNames = {"symbol"})
        },
        indexes = {
                @Index(name = "idx_symbol", columnList = "symbol"),
                @Index(name = "idx_name", columnList = "name"),
                @Index(name = "idx_exchange", columnList = "exchange"),
                @Index(name = "idx_sector", columnList = "sector")
        }
)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StockSymbol {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    // e.g. AAPL, TSLA, RELIANCE.NS
    @Column(nullable = false, length = 20)
    private String symbol;

    // e.g. Apple Inc, Reliance Industries
    @Column(nullable = false, length = 255)
    private String name;

    // Equity, ETF, Index
    @Column(length = 50)
    private String type;

    // Exchange name: NASDAQ, NYSE, BSE, NSE
    @Column(length = 50)
    private String exchange;

    // Country / Region
    @Column(length = 100)
    private String region;

    @Column(length = 10)
    private String marketOpen;

    @Column(length = 10)
    private String marketClose;

    @Column(length = 20)
    private String timezone;

    @Column(length = 10)
    private String currency;

    // Sector: Technology, Finance, Healthcare, etc.
    @Column(length = 100)
    private String sector;

    // Industry sub-category
    @Column(length = 150)
    private String industry;

    // Search relevance score (1.0 = exact match)
    @Column
    private Double matchScore;

    // When this symbol was last fetched/refreshed
    @Column(nullable = false)
    private LocalDateTime lastFetched;

    // Data source tracker
    @Column(length = 50)
    private String source = "TICKER_SEED";
}