<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class MarketTick extends Model
{
    protected $fillable = [
        'instrument_id',
        'ltp',
        'open',
        'high',
        'low',
        'close',
        'volume',
        'oi',
        'bid_price',
        'ask_price',
        'tick_at',
    ];

    protected function casts(): array
    {
        return [
            'tick_at' => 'datetime',
        ];
    }

    public function instrument(): BelongsTo
    {
        return $this->belongsTo(Instrument::class);
    }
}
